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

Re: Unsetting a variable that was not previously set

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:


        All name operands were successfully unset.
        At least one name could not be unset.

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.

> "Unsetting a variable or function that was not previously set shall
> not be considered an error and does not cause the shell to abort."

It doesn't cause the shell to abort currently.  The terminology in the
introduction does suggest `error' is more or less synonymous with
`non-zero return code', but I can find no normative indication of
whether this applies to the language used for the special builtins.

Probably someone should request a clarification.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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