Exit Value from Awk

Andy Behrens andyb at coat.com
Thu Jul 19 02:26:47 AEST 1990


stevens at hsi.UUCP (Richard Stevens) writes:
> Gary Mills writes:
>>
>> Does anyone know how to set the exit code from awk within an awk
>> script?
>
> Just say  "exit <expression>".  I just tried it and it works under
> V7 awk, SVR3.1 awk, nawk, and gawk.

That's correct.  

You should be aware, though, that if you have an END{ } block, awk will
execute it when it processes the "exit <expression>" statement.  When
the END{ } block is completed, awk will terminate with the exit code
specified in the expression.

Andy 



More information about the Comp.unix.questions mailing list