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

Re: "typeset -x" vs. "export" in 3.1.6

>>> "BS" == Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> writes:


 BS> There doesn't seem to have ever been doc written for "typeset -g".  

I have just read a paragraph about it in zshbuiltins.1 !


 BS> "typeset -x" meant "marks global and puts in the environment, iff
 BS> not marked local" which seems to have mutated into "puts in the
 BS> environment, iff marked global".  This has the effect of
 BS> rendering -x a no-op anywhere except at the top level, which I'm
 BS> pretty sure is incompatible with ksh.


 BS> Can someone who has a real ksh available please confirm
 BS> what the precise ksh behavior is?  Does it differ in 88/93?)

~ % echo $ZSH_VERSION
~ % emulate ksh
~ % foo() { typeset -x bar=123; sh -c 'echo $bar' }
~ % foo

~ % emulate zsh; strings =ksh | grep -i version
@(#)Version M-11/16/88i
~ % ksh
venus:281> foo() { typeset -x bar=123; sh -c 'echo $bar'; }
venus:282> foo                                  # note: ^--- is needed

So having 'typeset -x' doing 'typeset -xg' seems to be right for 
ksh emulation. 


Alexandre 'Pollux' Duret-Lutz

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