awk and shell question

Maarten Litmaath maart at cs.vu.nl
Thu Sep 28 02:42:17 AEST 1989


gs at diab.se (Greger Sernemar) writes:
\...
\a="`awk -F: '$1 == NAME {
\       user=$5;
\       print user
\       }' NAME=$LOGNAME - `"
\
\The last dash (-) closes standard input i.e enables other program to
\pipe to the awk script.

How can it pipe into awk when awk's stdin is closed?!
A dash doesn't mean CLOSE stdin, it means USE stdin!

\I was forced to either supply a file name or
\a dash to be able to set the awk variable.
\I'm not sure if this is a bug in the version of awk I'm using or not.

This is a bug indeed, present in SunOS 4.0.1 awk too.
Other bugs:

	% awk -F '{print}'
	awk: can't open {print}
	% awk -F
	awk: no argument for -f
	%
-- 
 `I AM NEW HEAR AMD I WANT TO INKRIMENT A |Maarten Litmaath @ VU Amsterdam:
 VURIABLE BY 1 (OONE) IN "c"'  (Tom Neff) |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.wizards mailing list