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

`unset`, zerr(), and `eval`



Consider the two following zsh snippets:

unset IFS
for i in "${(O)${(@f)$(set)}%%\=*}"
do unset $(eval echo $i)
done

unset IFS
for i in "${(O)${(@f)$(set)}%%\=*}"
do eval unset $i
done

The first loop terminates as soon as it hits the first read-only parameter
(which happens to be "status" in this case).  The second loop spits out a
warning message for every readonly parameter, and continues until it has
unset every parameter that it can.  (Both loops crash if you don't apply
the OLDPWD patch I sent this afternoon.)

Seems there could be two problems here.  Isn't it overkill to get zerr()'d
when attempting to unset a readonly parameter?  Is it intentional that an
"eval" will mask such errors?  (It's kinda perl-ish, I admit, but ...)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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