zsh-users
 help / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: dominik.vogt@gmx.de, Zsh Users <zsh-users@zsh.org>
Subject: Re: -u option does not work with recursive expansion?
Date: Fri, 15 Feb 2019 00:45:28 +0100
Message-ID: <CAHYJk3QLzi=H7ZoM4mObfr1drKHpgfNA_KPPsP6oBQaGSqpoCg@mail.gmail.com> (raw)
In-Reply-To: <20190214230743.drgd47wuwapj5os3@gmx.de>

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.

-- 
Mikael Magnusson

  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 [this message]
2019-02-15  0:41   ` Dominik Vogt
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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to='CAHYJk3QLzi=H7ZoM4mObfr1drKHpgfNA_KPPsP6oBQaGSqpoCg@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=dominik.vogt@gmx.de \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

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

zsh-users

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

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


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