From: Bart Schaefer <schaefer@brasslantern.com>
To: Roman Neuhauser <neuhauser@sigpipe.cz>, zsh-users@zsh.org
Subject: Re: set -o nounset; foo=(); print ${foo:#bar}
Date: Sat, 06 Sep 2014 12:34:33 -0700 [thread overview]
Message-ID: <140906123433.ZM20433@torch.brasslantern.com> (raw)
In-Reply-To: <20140906184749.GR4075@isis.sigpipe.cz>
On Sep 6, 8:47pm, Roman Neuhauser wrote:
}
} roman@wrench ~ 0 1078 0 > print ${foo:#bar}
} zsh: foo: parameter not set
} roman@wrench ~ 0 1079 1 >
}
} the problematic part is ${foo:#bar} triggering nounset. FMPOV it *is*
} set (but null), so i'd say the observed behavior is a bug.
This seems to be ${name:#word} being confused with ${name:?word} where
the ":" means to treat an empty parameter as unset. This also affects
the newer ${name:^word} form.
} is it fixable?
I don't immediately see a simple code change that would do so, but I'm
sure it can eventually be fixed.
} or is there at least a good workaround? (stuffing the
} array with a sentry is not a good workaround.)
You can use ${foo##bar(#e)} with extendedglob, I think, but it may
depend on context. Without extendedglob I don't see a good way.
next prev parent reply other threads:[~2014-09-06 19:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-06 18:47 Roman Neuhauser
2014-09-06 19:34 ` Bart Schaefer [this message]
2014-09-06 20:13 ` Roman Neuhauser
Reply instructions:
You may reply publicly 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=140906123433.ZM20433@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=neuhauser@sigpipe.cz \
--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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).