help / Atom feed
From: Dominik Vogt <dominik.vogt@gmx.de>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: -u option does not work with recursive expansion?
Date: Fri, 15 Feb 2019 01:41:10 +0100
Message-ID: <20190215004110.wq4pluv3fprt3gtf@gmx.de> (raw)
In-Reply-To: <CAHYJk3QLzi=H7ZoM4mObfr1drKHpgfNA_KPPsP6oBQaGSqpoCg@mail.gmail.com>

On Fri, Feb 15, 2019 at 12:45:28AM +0100, Mikael Magnusson wrote:
> On 2/15/19, Dominik Vogt <dominik.vogt@gmx.de> 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

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 23:07 Dominik Vogt
2019-02-14 23:45 ` Mikael Magnusson
2019-02-15  0:41   ` Dominik Vogt [this message]
2019-02-15  1:10     ` Bart Schaefer
2019-02-15  1:41     ` Matthew Martin

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190215004110.wq4pluv3fprt3gtf@gmx.de \
    --to=dominik.vogt@gmx.de \
    --cc=zsh-users@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link


Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/ public-inbox