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

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



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.

-- 
Mikael Magnusson



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