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

Unsetting a variable that was not previously set [kind of update]



Hello,

I noticed a "problem" when unsetting variable(s):

% cat foo1
#!/bin/sh -e
a=b
unset a && echo foo
unset a && echo bar
% ./foo1
foo

% cat foo2
#!/bin/sh -e
a=b
unset a && echo foo
unset c && echo bar
% ./foo2
foo


I found the thread "Unsetting a variable that was not previously
set" -> http://www.zsh.org/mla/users/2003/msg00312.html in the
zsh-ml-archive.

According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297137
bash3, dash and posh handle it in another way than zsh does.

That's what Chet [from bash] said about bash's behaviour (according
to <URL:http://www.zsh.org/mla/users/2003/msg00314.html>) ->

|    I got a bug report or two, and decided that the new behavior is
|    what POSIX.2 intended.  It seems to be what sh has always
|    done.

As this behaviour broke the hotplug-system on my Linux
Live-CD-system where zsh is used as /bin/sh I would like to know if
this behaviour of zsh might be changed in future or if I should fix
such scripts on my own.

thx && regards,
-mika-
-- 
 ,'"`.         http://www.michael-prokop.at/
(  grml.org -» Linux for texttool-users and sysadmins
 `._,          http://www.grml.org/



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