test/clos1way.awk
raw| 1 | BEGIN { |
| 2 | command = "sort" |
| 3 | |
| 4 | n = split("abcdefghijklmnopqrstuvwxyz", a, "") |
| 5 | for (i = n; i > 0; i--) { |
| 6 | # print "printing", a[i] > "/dev/stderr" |
| 7 | print a[i] |& command |
| 8 | } |
| 9 | |
| 10 | close(command, "to") |
| 11 | |
| 12 | # print "starting read loop" > "/dev/stderr" |
| 13 | do { |
| 14 | if (line) |
| 15 | print "got", line |
| 16 | # stopme(); |
| 17 | } while ((command |& getline line) > 0) |
| 18 | |
| 19 | # print "doing final close" > "/dev/stderr" |
| 20 | close(command) |
| 21 | } |