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

Re: Unsetting a variable that was not previously set



Peter wrote:
> Vincent Lefevre wrote:
> > zsh should return an exit status 0 when unsetting a variable that was
> > not previously set.
> >
> > See
> >   http://www.opengroup.org/onlinepubs/007904975/utilities/unset.html
> 
> I think you're probably right, but it's not completely clear.  The page
> you quote explicitly says:

I queried Chet about this when it was changed in bash (about a year
ago) and got this response:

    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.

    It's still open to debate, though.  I can be convinced otherwise.

I never made up my mind to do anything in part because ksh93 does the
same as zsh but it is probably right. Also, at the moment, it seems
that for an readonly variable, it is returning 0 which is clearly
wrong.

> Now, if it doesn't exist, it can't be unset, but I think by `unset' they
> mean `rendered such that it is not set whether or not it was before',
> which is your interpretation.

It seems a fair interpretation. Perhaps could be wise to have it
clarified though.

Oliver



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