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

Bug on parameter expansion when set -u is in effect



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