Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: -u option does not work with recursive expansion?
- X-seq: zsh-users 23871
- From: Dominik Vogt <dominik.vogt@xxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: -u option does not work with recursive expansion?
- Date: Fri, 15 Feb 2019 01:41:10 +0100
- In-reply-to: <CAHYJk3QLzi=H7ZoM4mObfr1drKHpgfNA_KPPsP6oBQaGSqpoCg@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>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20190214230743.drgd47wuwapj5os3@gmx.de> <CAHYJk3QLzi=H7ZoM4mObfr1drKHpgfNA_KPPsP6oBQaGSqpoCg@mail.gmail.com>
- Reply-to: dominik.vogt@xxxxxx
On Fri, Feb 15, 2019 at 12:45:28AM +0100, Mikael Magnusson wrote:
> On 2/15/19, Dominik Vogt <dominik.vogt@xxxxxx> wrote:
> > Why does the recursive expansion of foo not trigger an error
> > message with the -u option? Is that a bug? Is there some
> > woraround to get the expected error behaviour in all cases?
> >
> > -- snip --
> > set -u
> > foo=bar
> > unset bar
> > # ==> bar: parameter not set
> > echo $bar
> > # ==> no error?
> > echo ${${foo}}
> > -- snip --
>
> If the above command doesn't output bar, your shell is very broken. I
> think you're confused about what ${${foo}} means though. Putting a ${}
> inside another ${} doesn't perform indirect expansion, you need (P)
> for that.
Yeah, you're right. My memory believes this was different at some
distant point in the past, i.e. that ${${A}} used to do recursive
expansion.
Well, with (P) it's possible to do recursive expansion at the
right side of an assigntment, but can you also do soething like
foo=bar
${foo}=baz
i.e. treat the contents of foo as the lvalue of an assignment?
(Without using eval, of course.)
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author