Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 1997 15:36:57 +0200 (MET DST)
From:      Zahemszky Gabor <zgabor@CoDe.hu>
To:        freebsd-questions@freebsd.org (FreeBSD questions)
Cc:        un_x@anchorage.net
Subject:   Re: bug?
Message-ID:  <199704251336.PAA00476@CoDe.hu>
In-Reply-To: <Pine.BSF.3.95q.970425040839.15853F-100000@aak.anchorage.net> from Steve Howe at "Apr 25, 97 04:14:40 am"

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704251336.PAA00476>