Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

long pipelines and coprocesses



In a shell script I'm writing, I've got an enormous pipe of commands and
I've used the following construct as one of the commands in the pipe:

( ( [ "$dogrep" ] && grep "$1" ) || cat - ) | \

Does anyone know of a more efficient way of doing this (i.e. without the
cat -) other than having an outer if statement and repeating the whole
pipeline of commands.

What do I have to do to get coprocesses working in zsh scripts. They
aren't the best documented feature.

I have the following test script:

-----
while read file; do
  rm $file
done |&

:>testfile
ls
print -p testfile
ls
-----

It seems to work fine in ksh but in zsh it just hangs. I've tried it on
both AIX and IRIX.

Thanks

Oliver Kiddle



Messages sorted by: Reverse Date, Date, Thread, Author