Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: is variable with variable name possible?
- X-seq: zsh-users 15926
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: is variable with variable name possible?
- Date: Mon, 4 Apr 2011 17:28:24 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1301934506; bh=PVvjfcPFzgKFWh2So3tifp1n+woy0+AEdMKdB65/SZI=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:Content-Transfer-Encoding:In-Reply-To:User-Agent; b=nvjKaxFsbm54DzfoFaVDbYy3t5v+44O1MWEjllL7lExlkqawzMVaLvleZoKm80yIZ8IfNYgyzxkzYupBpD85sN6U76qbz+UM4/022pqAhkyzHEGxtNA8HafhkI3kfGwHt/KsOHRbq7ibAUd741CcEUEtl3qhsLA+Uy4QnBw8Tb8=
- In-reply-to: <BANLkTikffaVdTwNChVZzE6nKh3u9JMMyMA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: Mikael Magnusson <mikachu@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- 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>
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).
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author