Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!cs.dal.ca!david From: david@cs.dal.ca (David Trueman) Newsgroups: gnu.utils.bug Subject: Re: gawk's exit # statement doesn't work Message-ID: <9002021547.AA15271@cs.dal.ca> Date: 2 Feb 90 14:47:40 GMT References: <9002011730.AA25762@ai.cs.utexas.edu> Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 19 > 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 }