From owner-freebsd-hackers Wed Jul 14 9:57:45 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dorifer.heim3.tu-clausthal.de (dorifer.heim3.tu-clausthal.de [139.174.243.252]) by hub.freebsd.org (Postfix) with ESMTP id A778C153FC for ; Wed, 14 Jul 1999 09:57:41 -0700 (PDT) (envelope-from olli@dorifer.heim3.tu-clausthal.de) Received: (from olli@localhost) by dorifer.heim3.tu-clausthal.de (8.8.8/8.8.8) id SAA20332 for freebsd-hackers@FreeBSD.ORG; Wed, 14 Jul 1999 18:57:35 +0200 (CEST) (envelope-from olli) Date: Wed, 14 Jul 1999 18:57:35 +0200 (CEST) From: Oliver Fromme Message-Id: <199907141657.SAA20332@dorifer.heim3.tu-clausthal.de> To: freebsd-hackers@FreeBSD.ORG Subject: Re: bin/12578: `` subshell taints PWD Organization: Administration Heim 3 Reply-To: freebsd-hackers@FreeBSD.ORG MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: TIN [version 1.2 RZTUC(3) PL2] Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Niall Smart wrote in list.freebsd-hackers: > > > I'm not sure if XPG4v2 requires command substitution to behave > > like that. At least, both Solaris' and DEC UNIX... oops... > > True64 UNIX do execute all command substitutions in a subshell > > (`pwd` does not affect the surrounding shell), and both claim > > XPG4 compliance. > > They only execute a subshell when they need to: No, it _always_ spawns a subshell. > $ echo $$ `echo $$` > 14405 14405 > $ uname -a > SunOS molotov.boi.ie 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-5_10 That doesn't prove anything, because $$ always contains the PID of the "top-level" shell, as I explained in an earlier mail. Try this one: $ echo $$ `( /bin/echo $$ )` 14762 14762 I think you agree that a subshell is spawned in that case, don't you? ;-) Regards Oliver -- Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany (Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de) "In jedem Stück Kohle wartet ein Diamant auf seine Geburt" (Terry Pratchett) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message