Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Assign to parameter in parameter -- opposite of ${(P)name}?
- X-seq: zsh-users 15161
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: Assign to parameter in parameter -- opposite of ${(P)name}?
- Date: Sat, 10 Jul 2010 10:39:37 -0700
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <alpine.LNX.2.01.1007091908420.4808@xxxxxxxxxxx>
- 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: <alpine.LNX.2.01.1007091908420.4808@xxxxxxxxxxx>
On Fri, Jul 9, 2010 at 4:17 PM, Benjamin R. Haskell <zsh@xxxxxxxxxx> wrote:
> It's the end of the week, and I'm tired, so I'm sure I'm completely
> overlooking something obvious, but how do you *assign* to a parameter
> whose name is in a parameter?
Your first attempt wasn't complicated enough, but your second attempt
was too complicated. :-)
% name=foo
% : ${(P)name::=something}
% print $foo
something
% print $name
foo
The (P)name is interpreted before the ::= so you don't need nested expansion.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author