From owner-freebsd-questions Sat Aug 8 09:48:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA00364 for freebsd-questions-outgoing; Sat, 8 Aug 1998 09:48:05 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from aladdin.rotterdam.luna.net (aladdin.rotterdam.luna.net [194.151.24.25] (may be forged)) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA00322 for ; Sat, 8 Aug 1998 09:47:57 -0700 (PDT) (envelope-from code@luna.nl) Received: from luna.nl (26-pstn.rotterdam.luna.net [194.151.26.106]) by aladdin.rotterdam.luna.net (8.8.8/8.8.8/chk+rbl+tcpwrp+ismx+p3a) with ESMTP id SAA08556 for ; Sat, 8 Aug 1998 18:46:32 +0200 (MET DST) Message-ID: <35CC80A5.3B00716C@luna.nl> Date: Sat, 08 Aug 1998 18:45:25 +0200 From: Trifkac X-Mailer: Mozilla 4.5b1 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-questions@FreeBSD.ORG Subject: shell problem do while loop Content-Type: text/plain; charset=x-user-defined Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG   Hi, Would anyone know already the answer to this problem ? The default free bsd shell gives the same problem... Trifkac ------------------- 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