> Repeat-By:
> shopt -u extglob
> isnum () ( shopt -s extglob; case "$1" in [1-9]*([0-9])) return 0 ;;
> *) return 1 ;; esac; )
Remember that bash parses and interprets the script line-by-line. If you want
to change the parser's operation (for example, have it recognize the extglob
patterns), you have to do it in a different line than where you're using the
special syntax.
If you have: shopt -s extglob; ls @(foo|bar)
in the same line, it first processes the complete line, and fails at the
extglob, before getting to execute the shopt command.
This is not a bug btw, it's just a consequence of how bash works.
--
Eduardo Bustamante
https://dualbus.me/