From owner-freebsd-hackers Sun May 10 17:58:19 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA08330 for freebsd-hackers-outgoing; Sun, 10 May 1998 17:58:19 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from lamb.sas.com (root@lamb.sas.com [192.35.83.8]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA08307 for ; Sun, 10 May 1998 17:58:09 -0700 (PDT) (envelope-from jwd@unx.sas.com) Received: from mozart (mozart.unx.sas.com [192.58.184.8]) by lamb.sas.com (8.8.7/8.8.7) with SMTP id UAA29867 for ; Sun, 10 May 1998 20:58:09 -0400 (EDT) Received: by mozart (5.65c/SAS/Domains/5-6-90) id AA09375; Sun, 10 May 1998 20:58:08 -0400 From: "John W. DeBoskey" Message-Id: <199805110058.AA09375@mozart> Subject: Re: Unexpected behaviour from pdksh. Comments? To: freebsd-hackers@FreeBSD.ORG Date: Sun, 10 May 1998 20:58:08 -0400 (EDT) X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 ----- ----- Transcript of session follows ----- ... while talking to awfulhak.org.: >>> RCPT To: <<< 550 ... we do not relay jwd@unx.sas.com 550 ... 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 < `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