Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: is variable with variable name possible?
- X-seq: zsh-users 15927
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: is variable with variable name possible?
- Date: Mon, 4 Apr 2011 18:34:26 +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=jNHtwsQ3fMZiVaIilpTBXe/0dyKwbO8FLjZN5ZwpcyY=; b=mjO+rdftHqIbrVPiun6OhSKUeGBPexnD1gjIIUm27YgXHu5rCmBGqRNBB08YFkhx3v 4Faklny9haMBwVzyx3hzhaobkgEttsRdmGSkT6/IkjRx2lnlLAz8R//tgCztgn0eh5pG o6Re6stHKwxfJas0pOMwtplHRzVP48fBsEIOg=
- 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=hoBMOZhCn340v6X5ERUZixtmtj6yf8CLFitG98YUWQlHaqeHLNLbHf4gkyq8NMFMyB AH+ZtRC3q8SbqEyd8zdeFFQRZyWjPHRnVQ0PwER+uGc6q37XcdsWWFeRi8Q1OHMvMOoz XLcWR0U3uouXfCmneSaHr230rlYLY1VlE9djM=
- In-reply-to: <20110404162824.GB9371@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> <BANLkTikffaVdTwNChVZzE6nKh3u9JMMyMA@mail.gmail.com> <20110404162824.GB9371@yahoo.fr>
On 4 April 2011 18:28, Stephane Chazelas <stephane_chazelas@xxxxxxxx> wrote:
> 2011-04-04 16:25:01 +0200, Mikael Magnusson:
>> 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}
> [...]
>
> Try after
>
> sudo ln -s . '/*'
> cd '/*/*/*/*/*'
> setopt globsubst
>
> ;-)
>
> (if you're lucky, it won't crash your machine).
Pretty sure globsubst breaks your idea too, but fine,
: ${(P)~~somevar::=$PWD}
In fact, globsubst pretty much breaks every hook function i have :P.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author