Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bug on parameter expansion when set -u is in effect
- X-seq: zsh-workers 54171
- From: "Ronald Fischer" <ynnor@xxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Bug on parameter expansion when set -u is in effect
- Date: Thu, 05 Feb 2026 12:10:55 +0100
- Archived-at: <https://zsh.org/workers/54171>
- Feedback-id: ib78041aa:Fastmail
- List-id: <zsh-workers.zsh.org>
Using zsh 5.8.1 (x86_64-apple-darwin21.0)
Consider the following fragment of code:
kv="a b"
k=${kv%% *}
v=${kv##${k} #}
This would set k to "a" and v to "b", and indeed usually does so.
However, when I run this code with
set -u
in effect, the variable v is set to "a b" instead of "b".
I think this is a bug, because all variables are assigned a value before they are expanded, so -u should not have any effect.
Ronald Fischer
--
Ronald Fischer <ynnor@xxxxx>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author