Hello, while trying to export this function : ------------------------ foo() { case "$1" in ?(a)) echo a ;; esac } ------------------------ with export -f foo I went into some problem as soon as any new instance is launched : bash -c "foo bar" : failed xterm & : failed bash -O extglob : ok bash -O extglob -c "xterm" : failed
The failure of the new instance is the following : ------------------------- bash: foo: line 1: syntax error near unexpected token `(' bash: foo: line 1: ` ?(a))' bash: error importing function definition for `foo' ------------------------- In fact: - $SHELLOPTS doesn't contains extglob - $SHELLOPTS is readonly - bashrc is evaluated after the environment - the environment needs extglob It happens that sometimes you need to export some functions without explicitely wanting to add the extglob option. And alias bash='bash -O extglob' doesn't seem to be clean to me (even if possible as a workaround) So the feature request is about a way to set the extglob status from the environment. Kind of solution though in IRC : - shopt -s exportopts - shopt -s exportextglob - extglob part of $SHELLOPTS - load of a kind of .bashrc.env_insensible before anything else - ... I wish it's understandable, thank in advance. Raph