Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: -u option does not work with recursive expansion?

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

Well, with (P) it's possible to do recursive expansion at the
right side of an assigntment, but can you also do soething like


i.e. treat the contents of foo as the lvalue of an assignment?
(Without using eval, of course.)


Dominik ^_^  ^_^


Dominik Vogt

Messages sorted by: Reverse Date, Date, Thread, Author