To avoid the XY problem scenario, I'll explain why I'm asking this question.
I remember I had shopt -s extglob
set in my ~/.bashrc
file, because things like @(pattern-list)
do work.
However, I've just looked into ~/.bashrc
and that option is not set.
So I decided to see where it comes from, and discovered that
- if I launch another shell via
bash --norc
and then runshopt
I see the lineextglob off
, - whereas, if I launch it via
bash --rcfile /dev/null
, thenshopt
shows thatextglob on
,
which doesn't really help me in find out which file is extglob
is set in.
Based on a comment, PS4=' $BASH_SOURCE:$LINENO: ' bash -lixc true |& grep extglob
gives
/usr/share/bash-completion/bash_completion:45: shopt -s extglob progcomp
/usr/share/bash-completion/bash_completion:45: shopt -s extglob progcomp
strace -e openat
showsbash --rcfile /dev/null
opens/etc/bash.bashrc
in my Ubuntu 18.04, butbash --norc
doesn't.grep -H extglob ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login ~/.bash_aliases /etc/bash.bashrc /etc/profile /etc/profile.d/* /etc/environment 2> /dev/null
PS4=' $BASH_SOURCE:$LINENO: ' bash -lixc true |& grep extglob
/etc/bash.bashrc
(based on a compile-time setting). Even when--rcfile
is specified. This doesn't contradictman bash
("--rcfile file
Execute commands fromfile
instead of the standard personal initialization file~/.bashrc
if the shell is interactive") (it is different on Debian, see the relevant bug report). This unintuitive behavior has been reported upstream as a bug, but the maintainer seems to diagree.