* `unset`, zerr(), and `eval`
@ 1999-02-06 23:19 Bart Schaefer
0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 1999-02-06 23:19 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-02-06 23:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-06 23:19 `unset`, zerr(), and `eval` Bart Schaefer
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).