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

set -o nounset; foo=(); print ${foo:#bar}



hello,

i encountered a behavior i don't like and would like to get rid of. :)

  roman@wrench ~ 0 1074 0 > print $ZSH_VERSION
  5.0.5
  roman@wrench ~ 0 1075 0 > set -o nounset
  roman@wrench ~ 0 1076 0 > foo=()
  roman@wrench ~ 0 1077 0 > print $foo

  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.

is it fixable?  or is there at least a good workaround?  (stuffing the
array with a sentry is not a good workaround.)

-- 
roman



Messages sorted by: Reverse Date, Date, Thread, Author