Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Nov 1998 23:48:28 +0000
From:      Brian Somers <brian@Awfulhak.org>
To:        "John W. DeBoskey" <jwd@unx.sas.com>
Cc:        green@zone.syracuse.net (Brian Feldman), freebsd-current@FreeBSD.ORG
Subject:   Re: Changing sh for compatibility sake 
Message-ID:  <199811012348.XAA29687@woof.lan.awfulhak.org>
In-Reply-To: Your message of "Sun, 01 Nov 1998 11:56:31 EST." <199811011656.LAA14169@bb01f39.unx.sas.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Hi,
> 
>    I sent mail to this list a few months ago... pdksh doesn't run
> the tail-end of a pipe in the current shell environment, thus the
> following doesn't work as expected:
> 
> export FOUND=0
> ls | wc -l | while read fcnt; do
>    export FOUND=$fcnt
> done
> echo $FOUND
[.....]

The *only* shell I've ever seen that does this is the original ksh.  
I think it's a *great* feature, but it's also non-standard.  With it, 
you can also

  echo hello there | read a b

and get $a and $b back.  Certainly, any version of sh, ash, zsh, bash 
and pdksh that I've seen execute everything in the pipe in a subshell.

-- 
Brian <brian@Awfulhak.org>, <brian@FreeBSD.org>, <brian@OpenBSD.org>
      <http://www.Awfulhak.org>;
Don't _EVER_ lose your sense of humour....



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



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