Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 9/27/83; site hplabs.UUCP Path: utzoo!linus!security!genrad!mit-eddie!mit-vax!eagle!harpo!seismo!hao!hplabs!kg From: kg@hplabs.UUCP Newsgroups: net.unix-wizards Subject: AWK brain damage Message-ID: <2066@hplabs.UUCP> Date: Thu, 15-Dec-83 00:41:33 EST Article-I.D.: hplabs.2066 Posted: Thu Dec 15 00:41:33 1983 Date-Received: Sun, 11-Dec-83 04:39:46 EST Organization: Hewlett Packard Labs, Palo Alto CA Lines: 20 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