Thread View: gnu.utils.bug
3 messages
3 total messages
Started by Jim Meyering
Thu, 01 Feb 1990 17:29
gawk's exit # statement doesn't work
Author: Jim Meyering
Date: Thu, 01 Feb 1990 17:29
Date: Thu, 01 Feb 1990 17:29
9 lines
634 bytes
634 bytes
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
Re: gawk's exit # statement doesn't work
Author: David Trueman
Date: Fri, 02 Feb 1990 14:47
Date: Fri, 02 Feb 1990 14:47
19 lines
929 bytes
929 bytes
> 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 }
Re: gawk's exit # statement doesn't work
Author: Arnold Robbins
Date: Fri, 02 Feb 1990 17:19
Date: Fri, 02 Feb 1990 17:19
20 lines
1210 bytes
1210 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads