zsh-users
 help / color / mirror / code / Atom feed
From: Zefram <zefram@fysh.org>
To: Jerry Peek <jpeek@jpeek.com>
Cc: zsh-users@sunsite.auc.dk
Subject: Re: Two esoteric zsh questions
Date: Fri, 8 Sep 2000 21:19:42 +0100 (BST)	[thread overview]
Message-ID: <E13XUcg-0007If-00@crucigera.fysh.org> (raw)
In-Reply-To: <24818.968185312@jpeek.com> from Jerry Peek at "Sep 5, 2000 01:21:52 pm"

Jerry Peek wrote:
>1) Can anyone explain the difference in the following two cases?  The
>first sets a shell variable; the second sets an environment variable.
>In the second, I have to quote the `who`:
>
>	% whoson=`who`
>	% export WHOSON=`who`
>
>I looked through the FAQ and scanned through a change list... but
>didn't spot changes in more recent versions, so I'm asking the list.
>Is the difference a bug, side effect, or feature?

Side effect of the way `export' is defined.  These two commands use
completely different bits of shell grammar.  The first is a variable
assignment, in which field splitting is not performed -- everything
in the word on the RHS of the = is assigned to the variable named.
The second is a simple command; the first word is `export' and the
second is `WHOSON=`who`'.  In the expansion of that second word, the
backquoted section is subjected to field splitting (I think `` and
$() are the only places where zsh does field splitting by default),
which results in a simple command with more than just the two words.
The `export' command looks at each argument in turn and tries to make
an assignment out of it; its second and subsequent arguments in this
case are part of the output of who.

-zefram


  reply	other threads:[~2000-09-08 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-05 20:21 Jerry Peek
2000-09-08 20:19 ` Zefram [this message]
2000-09-08 22:25 ` Bart Schaefer

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=E13XUcg-0007If-00@crucigera.fysh.org \
    --to=zefram@fysh.org \
    --cc=jpeek@jpeek.com \
    --cc=zsh-users@sunsite.auc.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).