Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jul 1999 18:57:35 +0200 (CEST)
From:      Oliver Fromme <olli@dorifer.heim3.tu-clausthal.de>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: bin/12578: `` subshell taints PWD
Message-ID:  <199907141657.SAA20332@dorifer.heim3.tu-clausthal.de>

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




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