Date: Sun, 10 May 1998 20:58:08 -0400 (EDT) From: "John W. DeBoskey" <jwd@unx.sas.com> To: freebsd-hackers@FreeBSD.ORG Subject: Re: Unexpected behaviour from pdksh. Comments? Message-ID: <199805110058.AA09375@mozart>
next in thread | raw e-mail | index | archive | help
Hello, I seem to be unable to send mail to brian@Awfulhak.org... I'm not sure why. ----- The following addresses had permanent fatal errors ----- <brian@Awfulhak.org> ----- Transcript of session follows ----- ... while talking to awfulhak.org.: >>> RCPT To:<brian@Awfulhak.org> <<< 550 <brian@Awfulhak.org>... we do not relay jwd@unx.sas.com 550 <brian@Awfulhak.org>... User unknown Anyways... While I understand the following coding style, it isn't a very pretty sight when trying to convert the following: cmdx | cmdy | while read line1; do process line1 echo new_info | while read line2; do process line2 done done While I am not condoning the above (the processing of line1 could be a function of some sort), it is still much, much easier to read than the converted format noted below by Brian. So, what would it take to add execution of the last pipe element in the current shell? Thanks, John brian@Awfulhak.org (Brian Somers) says: > The *only* shell that executes the last bit of a pipe inline is the > original ksh. Pdksh, zsh, sh, ash, bash and probably just about all > other shells create a subshell. > > This is a pain - > > something | read this that theother > > must be changed to > > read this that theother <<eof > `something` > eof > > It's too late to change the other shells now though. >> Given the following sample Korn Shell script: >> >> export FOO=foo >> echo $FOO >> >> echo bar | while read var; do >> export FOO=$var >> echo $FOO >> done >> echo $FOO >> >> The output is: >> foo >> bar >> foo >> >> where I was expecting: >> foo >> bar >> bar To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805110058.AA09375>