[net.unix-wizards] AWK brain damage

bob%ucla-locus@sri-unix.UUCP (12/12/83)

From:  Bob English <bob@ucla-locus>

I'm not sure that this is all "totally bogus".  If awk recreated
a file or re-invoked a pipe every time it executed a line,
chances are you would only get output from the last line of your
file.  That's not a very useful feature, and I don't find it
"bogus" at all.  Awk isn't a shell, it's a filter.

--bob--

kg@hplabs.UUCP (12/15/83)

In (at least) 4.1BSD and System 5 awk:
The following awk script demonstrates three bugs...
END {
	print "Hello" > "file"
	print "cat file" | "/bin/sh"
	print "Folks" > "file"
    }

1. The second > appends to file rather than recreating it.
2. The piped command of line two is asynchronous and causes the 
   two lines of the file, rather than the first line only, to be output.
3. Due to the asynchrony of the second line, awk exits before the
   piped command of line two completes.

Reading the code makes it obvious that they are intentionally trying to
keep files (pipes) open, for efficiency, perhaps, although the result
is totally bogus.  If Aho, Kernighan, or Weinberger read this net trash 
would you comment on this please?
-- 
Ken Greer