meyering@CS.UTEXAS.EDU (Jim Meyering) (02/02/90)
Gawk exits with a zero `status' even with statements like "exit 1" > ai% gawk -V '{exit 2}' < /dev/null > Gnu Awk (gawk) 2.11, patchlevel 1 > ai% echo $status > 0 > ai% Jim Meyering meyering@cs.utexas.edu
david@cs.dal.ca (David Trueman) (02/02/90)
> Gawk exits with a zero `status' even with statements like "exit 1" > > > ai% gawk -V '{exit 2}' < /dev/null > > Gnu Awk (gawk) 2.11, patchlevel 1 > > ai% echo $status > > 0 > > ai% > > Jim Meyering meyering@cs.utexas.edu In this case, since no input records are read, the action is never executed and thus the exit status is not set. Giving the program some input will set the exit status, as will the program: BEGIN { exit 2 } or END { exit 2 }
arnold@audiofax.com (Arnold Robbins) (02/03/90)
In article <9002011730.AA25762@ai.cs.utexas.edu> meyering@CS.UTEXAS.EDU (Jim Meyering) writes: >Gawk exits with a zero `status' even with statements like "exit 1" >> ai% gawk -V '{exit 2}' < /dev/null >> Gnu Awk (gawk) 2.11, patchlevel 1 >> ai% echo $status >> 0 >> ai% >Jim Meyering meyering@cs.utexas.edu Not so. This statement is *never* executed, as EOF happens right away. If you type echo hi | gawk '{exit 2}' then it will indeed exit with a status of 2. I just checked. -- Arnold Robbins -- Senior Research Scientist - AudioFAX | Laundry increases 2000 Powers Ferry Road, #220 / Marietta, GA. 30067 | exponentially in the INTERNET: arnold@audiofax.com Phone: +1 404 933 7600 | number of children. UUCP: emory!audfax!arnold Fax: +1 404 933 7606 | -- Miriam Hartholz
demon@ibmpcug.co.uk (Cliff Stanford) (02/03/90)
In article <200@audfax.audiofax.com> arnold@audiofax.com (Arnold Robbins) writes: > If you type > > echo hi | gawk '{exit 2}' > > then it will indeed exit with a status of 2. I just checked. Just tried it under MsDos --- Works fine there too! -- Automatic Disclaimer: The views expressed above are those of the author alone and may not represent the views of the IBM PC User Group. -- Cliff Stanford demon@ibmpcug.co.UK Demon Systems Limited demon@cix.cix.UUCP 42 Hendon Lane cliffs@bix London N3 1TT - England
meyering@CS.UTEXAS.EDU (Jim Meyering) (02/05/90)
Thanks, Jim