"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, linux-questions-only@ssc.com
LinuxCare, http://www.linuxcare.com/


(!) zsh Co-processes

From Paul Ackersviller on Sun, 05 Mar 2000

Your comparison of ksh versus bash neglected to mention zsh, which does have co-processes, but using a different syntax than ksh. It can be made to emulate ksh in many regards, but in general puts it to shame (especially for interactive use).

-- Paul Ackersviller

(!) Guilty as charged. I did wonder as I was writing that whether there would be a zsh fan our there to correct me.
I don't use zsh, though I've seen that it has some cool features. I didn't know if it supported co-processes, and I didn't have the time to find out last month.
However, I did issue a quick 'apt-get install zsh' command as a result of your message. (I was curious what syntax it DOES use).
Hmmm... Okay! I see.
Here's an example of the zsh co-routine syntax:
coproc bc
print -p 4 + 5
read -p answer
echo $answer
The only difference is the 'coproc' keyword instead of the '|&' operator from ksh. I see that the >&p and <&p redirection operators work exactly as they do under ksh.
I also see that the zsh co-processes seem to have the same limitations as their Korn shell ancestors. The ones that come immediately to mind are:
However, I can see where most programmers would say that asking for these features is really gilding the lily.


Copyright © 2000, James T. Dennis
Published in The Linux Gazette Issue 52 April 2000
HTML transformation by Heather Stern of Tuxtops, Inc., http://www.tuxtops.com/


[ Answer Guy Current Index ] [ Index of Past Answers ] greetings 1 2 3 4
5 6 7 8 9
10 11 12 13 14 15 16 17
18 19 20 21 22 23 24


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Linux Gazette FAQ ] [ Next Section ]