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

Re: exit value of intermediate program in pipe



On May 3,  2:17am, Sweth Chandramouli wrote:
} Subject: Re: Re: exit value of intermediate program in pipe
}
} 	isn't this what wait was designed for?
} 
} foo () {
}    /bin/blah >>(grep -v "foo")
}    wait
} }

That doesn't work, because process substitutions [which is what >>(...)
is] and command substitutions [`...` and $(...)] are not placed in the
job table.  The wait command only waits for jobs that were backgrounded
with &.  (This could be considered a bug, I suppose.)

} 	what exactly is the syntax that >> uses to become a pipe

When the >> is immediately followed by a parenthesized command list, it
means pipe to that list.  There's also >(...) which uses a FIFO.

This is in the zsh tekinfo documentation, under "Process Substitution".
For input, <<(...), <(...), and =(...) use a pipe, a FIFO, and a temp
file, respectively.

} the way you describe it looks a lot like a ksh two-way pipe

Not having used ksh much and never having seen any ksh doc, I'm not sure
what that means; but the pipe isn't two-way.

} as i mentioned in my other
} reply to this thread, i've never been able to get |& to work

That just means redirect both stdout and stderr as the pipe input.  It is
a csh-ism, and not equivalent to the ksh syntax.  See the FAQ.  (I think
that means that you want the "coproc" builtin and <&p and >&p redirection
for setting up a "two-way pipe.")

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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