Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: export -f problem



Egad.  Apparently the rule is, if the first four characters of the value
of an environment variable are `() {', it gets defined as a function upon
import.  Look:

schaefer[504] export foo='(){echo hi there;}'
schaefer[505] bash2
bash2-2.03$ foo
bash2: foo: command not found
bash2-2.03$ 
schaefer[506] export foo='() {echo hi there;}'
schaefer[507] bash2
bash2: foo: line 1: syntax error near unexpected token `{echo'
bash2: foo: line 1: `foo () {echo hi there;}'
bash2: error importing function definition for `foo'
bash2-2.03$ 
schaefer[508] export foo='() { echo hi there; }'
schaefer[509] bash2
bash2-2.03$ foo
hi there
bash2-2.03$ 

I think this is rather horrible; but, if we actually implement something
like this, we have to make sure that we do not allow `preexec', `precmd',
`periodic', `TRAPxxx', etc. to be imported.



Messages sorted by: Reverse Date, Date, Thread, Author