[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Feature Request]export extglob from environment
From: |
Raph |
Subject: |
[Feature Request]export extglob from environment |
Date: |
Sat, 9 May 2009 15:54:33 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
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
- [Feature Request]export extglob from environment,
Raph <=