[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GAWK] Exit status, --lint

From: Aharon Robbins
Subject: Re: [GAWK] Exit status, --lint
Date: Thu, 24 Sep 2009 21:15:56 +0300

Greetings. Re this:

> Date: Thu, 24 Sep 2009 14:56:26 +0100
> From: "Denis M. Wilson" <address@hidden>
> To: address@hidden
> Subject: [GAWK] Exit status, --lint
> The exit status of gawk is undocumented, when
> gawk exits other than via an exit statement.
> E.g. when an error occurs using --lint=fatal.
> In that case the exit status is 2 and not
> EXIT_FAILURE (1 under glibc). Example:
> #!/bin/sh
> awk --lint=fatal -f - <<'ENDAWK'
>      print zzz
> }
> echo $?
> output:
> awk: -:2: fatal: reference to uninitialized variable `zzz'
> 2
> I am using Ubuntu 8.4
> Denis M. Wilson

Thanks for the note.  I fixed this in 3.1.7, which was released not
too long ago.  If you look in doc/gawk.texi, you will find:

        @node Exit Status
        @section @command{gawk}'s Exit Status

        @cindex exit status, of @command{gawk}
        If the @code{exit} statement is used with a value
        (@pxref{Exit Statement}), then @command{gawk} exits with
        the numeric value given to it.

        Otherwise, if there were no problems during execution,
        @command{gawk} exits with the value of the C constant
        @code{EXIT_SUCCESS}.  This is usually zero.

        If an error occurs, @command{gawk} exits with the value of
        the C constant @code{EXIT_FAILURE}.  This is usually one.

        If @command{gawk} exits because of a fatal error, the exit
        status is 2.  On non-POSIX systems, this value may be mapped
        to @code{EXIT_FAILURE}.

I don't currently have this in the man page.

Thanks for the bug report!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]