From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6729 invoked from network); 8 Sep 2000 20:19:25 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Sep 2000 20:19:25 -0000 Received: (qmail 25012 invoked by alias); 8 Sep 2000 20:19:10 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3413 Received: (qmail 25005 invoked from network); 8 Sep 2000 20:19:09 -0000 Subject: Re: Two esoteric zsh questions In-Reply-To: <24818.968185312@jpeek.com> from Jerry Peek at "Sep 5, 2000 01:21:52 pm" To: Jerry Peek Date: Fri, 8 Sep 2000 21:19:42 +0100 (BST) CC: zsh-users@sunsite.auc.dk X-Mailer: ELM [version 2.4ME+ PL66 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: From: Zefram 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