From owner-freebsd-questions Fri Apr 25 07:29:31 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id HAA18573 for questions-outgoing; Fri, 25 Apr 1997 07:29:31 -0700 (PDT) Received: from mail.EUnet.hu (www.eunet.hu [193.225.28.100]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id HAA18568 for ; Fri, 25 Apr 1997 07:29:28 -0700 (PDT) Received: by mail.EUnet.hu, id QAA08887; Fri, 25 Apr 1997 16:29:25 +0200 Received: (from zgabor@localhost) by CoDe.hu (8.7.5/8.7.3) id PAA00476; Fri, 25 Apr 1997 15:36:57 +0200 (MET DST) From: Zahemszky Gabor Message-Id: <199704251336.PAA00476@CoDe.hu> Subject: Re: bug? To: freebsd-questions@freebsd.org (FreeBSD questions) Date: Fri, 25 Apr 1997 15:36:57 +0200 (MET DST) Cc: un_x@anchorage.net In-Reply-To: from Steve Howe at "Apr 25, 97 04:14:40 am" X-Mailer: ELM [version 2.4ME+ PL11 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > i've had some buggy problems with sh, and think i narrowed one down > (2.2.1) - invoke with an argument ... > > # this will not echo "goodbye". > while [ $1 ]; do xxx=goodbye!; shift; done | cat; echo $xxx > > # this will ... > while [ $1 ]; do xxx=goodbye!; shift; done; echo $xxx As I know, INABIAF. As with |, the shell creates a subshell, and generates two subprocesses. The while is running in one of the subprocesses, and in that shell, sets the variable. And of course, cat is running in the another subprocess. (As I know, only the original - ATT - ksh can do that in your way, and neither /bin/sh, nor bash/zsh/pdksh.) Try this one: $ echo 13 | read b ; echo ":$b:" :: $ Gabor