From owner-freebsd-current Sun Nov 1 15:49:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA27439 for freebsd-current-outgoing; Sun, 1 Nov 1998 15:49:15 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from awfulhak.org (awfulhak.force9.co.uk [195.166.136.63]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA27416 for ; Sun, 1 Nov 1998 15:49:11 -0800 (PST) (envelope-from brian@Awfulhak.org) Received: from woof.lan.awfulhak.org (root@woof.lan.Awfulhak.org [172.16.0.7]) by awfulhak.org (8.8.8/8.8.8) with ESMTP id XAA21034; Sun, 1 Nov 1998 23:47:53 GMT (envelope-from brian@Awfulhak.org) Received: from woof.lan.awfulhak.org (brian@localhost [127.0.0.1]) by woof.lan.awfulhak.org (8.9.1/8.9.1) with ESMTP id XAA29687; Sun, 1 Nov 1998 23:48:29 GMT (envelope-from brian@woof.lan.awfulhak.org) Message-Id: <199811012348.XAA29687@woof.lan.awfulhak.org> X-Mailer: exmh version 2.0.2 2/24/98 To: "John W. DeBoskey" cc: green@zone.syracuse.net (Brian Feldman), freebsd-current@FreeBSD.ORG Subject: Re: Changing sh for compatibility sake In-reply-to: Your message of "Sun, 01 Nov 1998 11:56:31 EST." <199811011656.LAA14169@bb01f39.unx.sas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 01 Nov 1998 23:48:28 +0000 From: Brian Somers Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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 , , 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