Martin von Gagern wrote:
The reason that [[ conditional commands don't require extglob to be
enabled while they're executed (and case commands do) lies in how the
commands are defined to behave. case commands are defined by Posix:
the pattern is always a Posix shell pattern, and any
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc'
Greg Wooledge wrote:
You're using extglobs inside a function, and extglob was enabled
at the time the function was delcared. The parser parsed them at that
time, decided that they are extended globs, and therefore that's what
they are.
Then why don't they work as extended globs if the
Martin von Gagern wrote:
I've found out that extglobs behave differently in different
constructs. To avoid syntax errors, the always have to be
enabled at parse time.
For comparison constructs like ``[[ $v == a@(a|b|c)c ]]'' this
is enough. For case constructs
Chet Ramey wrote:
In general, if you enable extglob before a function is parsed and leave
it on when the function is executed, you should be ok.
I'm thinking about this in terms of bash completion functions. Many of
them use extended globs, but they should not force a specific permanent
extglob
Martin von Gagern wrote:
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'