From owner-freebsd-questions Thu May 7 19:38:32 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA28771 for freebsd-questions-outgoing; Thu, 7 May 1998 19:38:32 -0700 (PDT) (envelope-from owner-freebsd-questions@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 TAA28610 for ; Thu, 7 May 1998 19:37:05 -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 WAA23959 for ; Thu, 7 May 1998 22:37:06 -0400 (EDT) Received: by mozart (5.65c/SAS/Domains/5-6-90) id AA16907; Thu, 7 May 1998 22:36:55 -0400 From: "John W. DeBoskey" Message-Id: <199805080236.AA16907@mozart> Subject: Unexpected behavior from pdksh To: freebsd-questions@FreeBSD.ORG Date: Thu, 7 May 1998 22:36:54 -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-questions@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. Thanks, John To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message