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

Re: Unsetting a variable that was not previously set

On Fri, Apr 04, 2003 at 17:09:49 +0100, Peter Stephenson wrote:
> I think you're probably right, but it's not completely clear.  The page
> you quote explicitly says:
>      0
>         All name operands were successfully unset.
>     >0
>         At least one name could not be unset.
> Now, if it doesn't exist, it can't be unset,

I don't think that a variable needs to exist in order to be unset.
I think that 'unset' is just a special status (or "value") for the
variable (a bit like 'undef' in Perl). So, we have the following

> but I think by `unset' they mean `rendered such that it is not set
> whether or not it was before', which is your interpretation.

and I think that this is the goal of the following sentence to make
things clear about this problem:

> > "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.

I could only find


Under "EXIT STATUS": "Usually, utilities return zero for successful
completion and values greater than zero for various error conditions."

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

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