Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: handling of variables
- X-seq: zsh-users 8451
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: handling of variables
- Date: Tue, 1 Feb 2005 14:06:16 +0000
- In-reply-to: <2005-02-01T12-49-14@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2005-02-01T12-49-14@xxxxxxxxxxxxxxxxxxxxxxxxx>
On Tue, Feb 01, 2005 at 12:57:37PM +0100, Michael Prokop wrote:
> Hello,
>
> I'm just wondering about:
>
> % zsh -f
> % FOO=BAR /bin/echo "$FOO"
>
> %
>
> Why doesn't this work? Am I running out of coffee? :)
[...]
Because that calls echo with FOO=BAR in its environment, it's
not echo that expands "$FOO", it's the shell.
You can do:
FOO=BAR eval '/bin/echo "$FOO"'
Here, it's eval that expands "$FOO", so it makes sense to put
FOO=BAR in its /environment/.
(note that with POSIX shells (and zsh in sh emulation), it's
FOO=BAR command eval '/bin/echo "$FOO"'
otherwise $FOO retains its value even after the eval).
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author