From mboxrd@z Thu Jan 1 00:00:00 1970 From: random832@fastmail.com (Random832) Date: Sat, 10 Sep 2016 13:06:56 -0400 Subject: [TUHS] Shell control through external commands In-Reply-To: <20160910091307.GE14636@yeono.kjorling.se> References: <1468585644.26769.for-standards-violators@oclsc.org> <20160910074508.GE5970@dnied%tiscali.it> <20160910091307.GE14636@yeono.kjorling.se> Message-ID: <1473527216.2633960.721672049.702FC02A@webmail.messagingengine.com> On Sat, Sep 10, 2016, at 05:13, Michael Kjörling wrote: > On 10 Sep 2016 09:45 +0200, from dnied at tiscali.it (Dario Niedermann): > > Il 15/07/2016 alle 14:27, Norman Wilson ha scritto: > >> lu$ cat /bin/cd > >> #!/bin/sh > >> builtin cd "$@" > >> lu$ > > > > But doesn't this change the current dir only in the child shell? > > Which then exits right after the second line, parent shell's $PWD > > unaffected. I really don't see how this script is useful. I've wondered about this in the past, the conclusion was that it is something that is technically required by POSIX. There is a general requirement that "regular builtin" commands [with no exception for cd] "shall be implemented in a manner so that they can be accessed via the exec family of functions as defined in the System Interfaces volume of POSIX.1-2008 and can be invoked directly by those standard utilities that require it (env, find, nice, nohup, time, xargs)."