Chris Fearnley on Sun, 9 Mar 1997 15:35:14 -0500 (EST) |
As it turns out, I don't understand bash's process substitution. I saw a ghost (as we say in chess after blundering). Here's a quote from the bash man page in case anyone else has a clue: Process Substitution Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files. It takes the form of <(list) or >(list). The pro- cess list is run with its input or output connected to a FIFO or some file in /dev/fd. The name of this file is passed as an argument to the current command as the result of the expansion. If the >(list) form is used, writing to the file will provide input for list. If the <(list) form is used, the file passed as an argument should be read to obtain the output of list. Here is the script that I thought used process substitution (maybe it does??): mkfifo junkfifo1 until [ "$EX" = "QUIT" ]; do EX=$(cat <(cat junkfifo1 )); echo "Command: $EX"; done [In another window "cat something > junkfifo1; cat QUIT > junkfifo1"] And here is the modification I made that convinced me that I don't know what I'm talking about: until [ "$EX" = "QUIT" ]; do EX=$(cat < junkfifo1); echo "Command: $EX"; done In both cases you can read from the FIFO and process the results. But the simpler syntax of my second attempt seems better to me. I guess it's time to subscribe to gnu.bash ... The FAQ suggests that maybe ksh88 coprocesses are like process substitution. Anyone know how coprocesses work? -- Christopher J. Fearnley | Linux/Internet Consulting cjf@netaxs.com, cjf@onit.net | Design Science Revolutionary http://www.netaxs.com/~cjf | Explorer in Universe ftp://ftp.netaxs.com/people/cjf | "Dare to be Naive" -- Bucky Fuller
|
|