Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!decuac!bacchus.pa.dec.com!bacchus!mwm From: mwm@raven.relay.pa.dec.com (Mike (My Watch Has Windows) Meyer) Newsgroups: comp.sys.amiga.tech Subject: Re: Pipe syntax... I think I'd better think it out again... Message-ID: Date: 26 Nov 90 00:05:50 GMT References: <1990Nov18.090654.24747@agate.berkeley.edu> <1990Nov24.073827.10945@agate.berkeley.edu> Sender: news@wrl.dec.com (News) Organization: Missionaria Phonibalonica Lines: 80 In-Reply-To: pete@violet.berkeley.edu's message of 24 Nov 90 07:38:27 GMT In article <1990Nov24.073827.10945@agate.berkeley.edu> pete@violet.berkeley.edu (Pete Goodeve) writes: Heh. I guess it all depends what'cha mean by "unix" dunnit... (:-)) It also seems to depend on what you mean by "ksh". You're right -- the violet version of ksh has this feature (but boy was it hard to find in the docs) but the one we have available for Suns doesn't, neither does the one supplied as the standard shell for our new IBM 6000. Actually, the Unix and the ksh involved are all nearly the same. There's a relatively standard extension providing a new pseudo-device (/dev/fd/*). Ksh has, for quite a while, looked for that device and turned on the '()' feature if it was there. That's really the only difference between all those systems - whether or no the the fd pseudo-device is on them. And Peter da Silva reported yet ANOTHER ksh (or did he mean sksh?) syntax using '$' a few messages back. Actually, Peter suggested the ksh features, using a form modified to be acceptable in an AmigaDOS environment. I think his form is just fine. $( ) replaces ` ` in the standard Unix shells (this is a kshism), and @( ) replaces ( ) in ksh, as AmigaDOS already uses ()'s for grouping in patterns. The ( ) quoting of embedded commands beats using the three "standard" quotes because it handles embedded commands without further work. Yes, it's quite neat, but it still has a strict hieararchical structure. The sort of schemes we've been tossing around would allow connections that would be impossible under the ksh method. Take this hypothetical [and doubtless dumb] requirement: A process P generates a stream of data that is cloned and fed in parallel to filter processes Q and R. A `diff' process takes the two outputs Q and R, and generates a differences stream. ____ ---- Q --->| | | | | P-->| |diff|---> result | | | ---- R --->|____| This could be done with several of the PIPE command variants people have suggested, but not with ksh embedding. Q and R could be embedded as diff args, but how would you get the output of P to them both? Actually, this isn't dumb. This is the kind of thing I wind up doing all to often (except I tend to use uniq or comm instead of diff). Typical is: for everyone in the password file in WSE, pull their mail address from the aliases file, save that, and then verify we got everybody. In the appropriate environment, this looks like: grep WSE /etc/passwd | awk -F: ' { print $1 } ' | sort | ???? | # this needs to be the split fgrep -f /dev/stdin /usr/lib/aliases | sed '/ /d' | tee aliaslist | sed 's/.*://' | sort | uniq -u - (????) # and this is where the split needs to rejoin The result of this would be a list of everyone in the password file who doesn't have a mail machine listed in the aliases file (given assumptions I happen to know are true about our aliases file, of course), along with the alias list in a file for later perusal. The script I mentioned for AmigaDOS handled this just fine using PIPE:. In reality, you don't care if a pipe buffers in this instances. In fact, you probably prefer it - fewer context switches, because one process keeps chewing stuff until it blocks, then the other starts in on it. So, do you have a syntax that correctly deals with this? As far as I'm concerned, PIPE: does just fine. The user needs to specify when things rejoin, and has to provide a name at both ends to do that. Intelligent name choices prevent should prevent clashes. PIPE: to indicate that this is a pipe instead of a real file is acceptable. BTW, the people at GIT did something along these lines for the Software Tools on Primos nearly 20 years ago. All I've heard is rumors, though.