[TUHS] Shell control through external commands

Random832 random832 at fastmail.com
Sun Sep 11 03:06:56 AEST 2016


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)."



More information about the TUHS mailing list