Exit Value from Awk

Bob McGowen x4312 dept208 bob at wyse.wyse.com
Thu Jul 19 02:08:10 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'.
>-- 
>-Gary Mills-             -University of Manitoba-             -Winnipeg-

Use the `exit' function:

   awk '{  # your code
	   if (some_condition)
	      exit 0
	   else
	      exit 1
	}' ...

Cheers- :-)

Bob McGowan  (standard disclaimer, these are my own ...)
Product Support, Wyse Technology, San Jose, CA
..!uunet!wyse!bob
bob at wyse.com



More information about the Comp.unix.questions mailing list