Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: is variable with variable name possible?
- X-seq: zsh-users 15924
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: is variable with variable name possible?
- Date: Mon, 4 Apr 2011 16:25:01 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=nQrG0uQPrE0PmV8Dx2pwDYeMMaHmj75VsD0nbf17Qfo=; b=o/ct4PdKHV6mZ0vgvIsh72hyW2SRyzXDxnSio8wqk4pB154HeywleHJS5gByOEb8ao ycUbEjqnr+oKWtGnmy3JSlTqkFG/WVCdCMIIu6tuncNOTdn8ngGQqSblEZvbtousimD8 MSU3wFlVdbuwv+crK0sEudd31wWD2xUp8NskI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=N+7c75z2XS4Z/lrV/49g+qCCntpGMTjRlMc/jw4WMwnyeUUmtmeK9L2Li8NXUj/nL/ 6V3kKJ4X2HpeU/q6jQe+UutOSsA4uyB8muKOLnqx2YKVr3GILqAIDiV5bNpyGW9T6VFv TtEgx2T6BL272UwFzJcSklCM6N4Bb/cojm8j8=
- In-reply-to: <20110404140651.GA9371@yahoo.fr>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <Xns9EBD94C46B8C1zzappergmailcom@80.91.229.10> <BANLkTimegXA4_5Co4sSWKgOmY_U-EWE6Pg@mail.gmail.com> <20110404140651.GA9371@yahoo.fr>
On 4 April 2011 16:06, Stephane Chazelas <stephane_chazelas@xxxxxxxx> wrote:
> 2011-04-04 15:48:32 +0200, Jérémie Roquet:
> [...]
>> 2011/4/4 zzapper <david@xxxxxxxxxx>:
>> > somevar=$(pwd)
>> >
>> > but I want somevar to be a variable name
>>
>> $ eval "$somevar=$(pwd)"
> [...]
>
> No!
>
> eval "$somevar=\$(pwd)"
> or
> eval "$somevar=\$PWD"
>
>
> Or think of what would happen if $PWD was "/tmp/x;rm -rf /home"
How do you feel about this?
: ${(P)somevar::=$PWD}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author