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

Re: inconsistent behavior observed with export VAR=VAL versus VAR=VAL zsh 4.2.6



On Fri, 17 Aug 2007 23:15:36 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> Nex Magik wrote:
>> stimpy% Y="foo bar"
>...
>> stimpy% export Z=$(/bin/echo $Y):$PATH
>> export: not an identifier: bar:/tmp/opt/spi/RapiDev_99a-RC1/tools/bin:/opt/gc
>> c-3.2.3/bin:/opt/python-2.4.4/bin:/usr/local/bin:/bin:/usr/bin:/home/jkim/bin
>> /exec/i686-Linux2:/home/jkim/bin/shell:/home/jkim/bin/shell/LOGIN/i686-Linux2
>> stimpy
> 
> If this is what you're worried about, it's not a bug.  zsh applies
> completely consistent rules for arguments splitting of commands,
> including "export" and it's relatives, which means if you don't want
> $(...) expansions to be split into words then you must tell it not to.
> The standard way is to put double quotes around the expansion.  However,
> if you want to change the behaviour permanently you can set the option
> KSH_TYPESET.  See its documentation in the zshoptions manual.

Jason told me this was to do with a bash script he was trying to run in
zsh, and I notice that we don't turn on KSH_TYPESET in Bourne/POSIX
shell emulation, only ksh emulation.  It's not obvious to me from the
POSIX docs at www.opengroup.org that the bash behaviour is the approved
one, but they usually get this right and it's possible I'm missing
some obscure paragraph.  Has anyone run across this?

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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