My non-interactive bash shell has
extglob off. I would like to turn it on in the statement immediately before a command, but I have noticed that when
shopt -s extglob is within an
if .. then .. else block, it somehow does not register.
The following extglob-dependant command is not valid:
syntax error near unexpected token '('.
extglob be set, and why is there a restriction, at all? Does this apply to other options? ... GNU bash 4.1.5
shopt -s extglob if true ;then touch a.bcd; ls a.@(bcd) fi
if true ;then shopt -s extglob touch a.bcd; ls a.@(bcd) fi ... line 17: syntax error near unexpected token `(' ... line 17: `touch a.bcd; ls a.@(bcd)'