Exit Value from Awk

Neil Readwin nreadwin at miclon.uucp
Fri Jul 20 03:53:12 AEST 1990


In article <1990Jul17.203037.22283 at ccu.umanitoba.ca> mills at ccu.umanitoba.ca (Gary Mills) writes:
>Does anyone know how to set the exit code from awk within an awk
>script?  My AT&T and Sun manuals are silent on this.  I want to
>be able to do: `awk -f file file || cat file'.

According to an old posting from jwp%chem at sdcsvax.ucsd.edu

# The user manual says that using the exit function causes the script to
# behave as if end-of-input has been reached.  Not mentioned explicitly 
# is the fact that this will cause the END block to be executed if it 
# exists.  Also, two things are omitted:
#
#   exit(expr) causes the script's exit status to be set to the value of expr.
# 
#   If exit is called within the END block, the script exits immediately.
-- 
 Disclaimer: 818  Phone: +44 71 528 8282  E-mail: nreadwin at micrognosis.co.uk



More information about the Comp.unix.questions mailing list