bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] exit in END block


From: isabella parakiss
Subject: [bug-gawk] exit in END block
Date: Tue, 24 Mar 2015 07:29:28 +0100

"If an expression is specified in an exit statement, its numeric value
shall be the exit status of awk, unless subsequent errors are encounte-
red or a subsequent exit statement with an expression is executed."

This is from the POSIX standard.  I believe that gawk is wrong on it:

$ gawk 'BEGIN { exit 42 } END { exit }'; echo $?
0
$ mawk 'BEGIN { exit 42 } END { exit }'; echo $?
42

An expression was specified, and no subsequent exit statement with an
expression was encountered.  According to the standard, this should
exit with 42, right?  With --posix I get the same result.

Is there a reason for this?


---
xoxo iza



reply via email to

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