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

Re: Re: exit value of intermediate program in pipe

On Sun, May 03, 1998 at 02:30:14AM -0700, Bart Schaefer wrote:
> 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.")
	man, if i could just learn to rtfm... i saw that section a while
ago in the man page, but since it was under "simple commands", i just
skimmed it and moved on.
	even reading it carefully, though, i'm still not sure what the
coproc syntax is.  to recreate the function we're discussing with a two-way
pipe (which would background one process so that the exit statuses could
be separated), in ksh i would do

grep -v bar |&
print -p `/bin/blah ; exitstatus=$?`
read -p output
echo $output
return $exitstatus

	or something like that.  for zsh, would i just do
grep -v bar coproc |
>&p `/bin/blah ; exitstatus=$?`
<&p output ; echo $output
return $exitstatus


	(i'm not checking mail on a machine that i could test this
on, or i would just go ahead and do so.)

	what zsh really needs is something like the hawksbill book from
oreilly for ksh, that gives a lot of examples and compares it to other
shells; i'm sure that half of my failures at zsh scripting come from
trying to use ksh-isms that i assume are implemented.

	-- sweth.

"Countin' on a remedy I've counted on before
Goin' with a cure that's never failed me
What you call the disease
I call the remedy"  -- The Mighty Mighty Bosstones

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