From owner-freebsd-hackers Sat May 9 18:52:29 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA28586 for freebsd-hackers-outgoing; Sat, 9 May 1998 18:52:29 -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 SAA28577 for ; Sat, 9 May 1998 18:52:21 -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 VAA23635 for ; Sat, 9 May 1998 21:52:22 -0400 (EDT) Received: by mozart (5.65c/SAS/Domains/5-6-90) id AA24180; Sat, 9 May 1998 21:52:22 -0400 From: "John W. DeBoskey" Message-Id: <199805100152.AA24180@mozart> Subject: Unexpected behaviour from pdksh. Comments? To: freebsd-hackers@FreeBSD.ORG Date: Sat, 9 May 1998 21:52:21 -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 Hi, The following is on 3.0-CURRENT using pdksh. 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 If I put the value 'bar' in a file and change the while loop to: echo bar > varfile while read var; do export FOO=$var echo $FOO done < varfile I get the expected reult with the above. It seems that the pipe '|' is causing the 'while read var' to execute in a subshell. Does anyone know of a way to make this work the way I am expecting it to? fyi: this seems to work ok under hpux 9.05 & 10.20 and SunOS 5.6... Thanks, John To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message