zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Nex Magik <nexmagik@yahoo.com>, zsh-workers@sunsite.dk
Subject: Re: inconsistent behavior observed with export VAR=VAL versus VAR=VAL zsh 4.2.6
Date: Fri, 17 Aug 2007 23:15:36 +0100	[thread overview]
Message-ID: <200708172215.l7HMFalO004036@pws-pc.ntlworld.com> (raw)
In-Reply-To: Message from Nex Magik <nexmagik@yahoo.com> of "Fri, 17 Aug 2007 12:29:27 PDT." <432520.66027.qm@web50101.mail.re2.yahoo.com>

Nex Magik wrote:
> This is a strange issue, it has a workaround, but its still strange.
> 
> The very short way to see it is to try to append an expression
> with spaces in it to a variable.
>
> 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.

The case without "export" in front is treated differently because the
expansion is no longer part of a command argument; the rules are
different for shell assignments, with no word splitting being done on
the right hand side of the assignment.

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


  reply	other threads:[~2007-08-17 22:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-17 19:29 Nex Magik
2007-08-17 22:15 ` Peter Stephenson [this message]
2007-08-18  9:46   ` Peter Stephenson
2007-08-18 10:03   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200708172215.l7HMFalO004036@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=nexmagik@yahoo.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).