Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: is variable with variable name possible?
- X-seq: zsh-workers 28976
- From: ZyX <zyx.vim@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: is variable with variable name possible?
- Date: Tue, 5 Apr 2011 08:09:27 +0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:reply-to:to:subject:date:user-agent :references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=5aZeQ/lflRSSJXFbVg6KElK5NFoD0Koba1ZlbyFov8I=; b=g0PtmTIOj5LeRGwFR4MleBtTEblGYZLkXHvAWq0ky7nDR1B7BtkcaX+fGoFG5sgcIU IjBAzp3m60NxUYKylYSWBdCEFr0ZEbAta5N3SKwYCmfW5jcluyr8dzv8lYhdcohB6Zdi l8hMqFksGk7thxWM35BGJeJnXFq7kT542u7aM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=TaoJZ0eV98XB/BEiJAEW7vGdgR8DUHL5Rcg12mFq8xDn8hAlHFQDfDxHgAypB3krKr sdbpedDWQUYZhOeXQkbu1t4KWZnYQuWwMtT7UQDeoBTd8zA/dohrUKhDP0WGT80cJhKb PtUktjSy+LBW5mwGA7cXsHXjaJnher7V/SXHk=
- In-reply-to: <BANLkTimU=NGp8eMkQKmNony3n4sR8ezreQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <Xns9EBD94C46B8C1zzappergmailcom@80.91.229.10> <20110404162824.GB9371@yahoo.fr> <BANLkTimU=NGp8eMkQKmNony3n4sR8ezreQ@mail.gmail.com>
- Reply-to: zyx.vim@xxxxxxxxx
Reply to message «Re: is variable with variable name possible?»,
sent 20:34:26 05 April 2011, Tuesday
by Mikael Magnusson:
> Pretty sure globsubst breaks your idea too, but fine,
>
> : ${(P)~~somevar::=$PWD}
>
> In fact, globsubst pretty much breaks every hook function i have :P.
`emulate -L zsh' at the top of each function and it will be unbreakable by such
options.
Original message:
> 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.
Attachment:
signature.asc
Description: This is a digitally signed message part.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author