Move under www to ease rsync
This commit is contained in:
27
www/eps/hpr3413/hpr3413_coproc_test.awk
Executable file
27
www/eps/hpr3413/hpr3413_coproc_test.awk
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
BEGIN {
|
||||
# Turn off buffering with bash
|
||||
coproc = "stdbuf -i0 -o0 -e0 bash"
|
||||
|
||||
i = 0
|
||||
|
||||
# Commands we'll send
|
||||
com[i++] = "date"
|
||||
com[i++] = "whoami"
|
||||
com[i++] = "id"
|
||||
com[i++] = "exit"
|
||||
|
||||
i = 0
|
||||
|
||||
# Write and read in a loop → buffering problems?
|
||||
do {
|
||||
print com[i++] |& coproc
|
||||
coproc |& getline results
|
||||
if (i in com) print ":", results
|
||||
} while (i in com)
|
||||
close(coproc)
|
||||
|
||||
}
|
||||
|
||||
# vim: syntax=awk:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21
|
||||
Reference in New Issue
Block a user