execline
Software
skarnet.org
The cd program
cd changes the current working directory to a
given directory, then executes a program.
Interface
cd dir prog...
cd performs a
chdir()
system call on dir, then execs into prog....
Notes
- This cd program will never be invoked by a shell, unless its full path
is explicitly given to the shell command line. So it is perfectly acceptable and valid
to have a cd binary in the filesystem. No confusion will be possible: shells
will invoke their builtin
cd
utility, and execline scripts will invoke the cd binary.
- Previous versions of POSIX also required a conformant cd binary to exist
in the filesystem, for no reason at all. So, in previous execline versions,
a posix-cd binary was present, and cd could be installed as a symlink
to it when execline was configured with the --enable-pedantic-posix option.
This allowed distributions to make execline binaries, including cd, available
in PATH, while strictly conforming to POSIX. This requirement has now been relaxed by
POSIX, so the needlessly complex posix-cd program was replaced with this
simpler cd, that can now be made available in PATH without breaking strict
conformance.