As referenced in this fine answer, POSIX systems have an external binary cd in addition to the shell builtin. On OS X 10.8 it's /usr/bin/cd. You can't use it like the builtin cd since it exits immediately after changing its own working directory. What purpose does it serve?
|
It serves primarily as making sure the POSIX tool-chest is available both inside and outside a shell. Also, the Example:
Another potential side-effect is the automounting of a directory. On a few systems, most of the external commands for the standard shell builtins are implemented as a symlink to the same script that does:
That is start a shell and run the builtin in it. Some other systems (like GNU), have utilities as true executable commands which can lead to confusions when the behavior differs from the shell builtin version. |
||||
|
|
|
The fact a non builtin cd command is available is essentially due to the POSIX requirement for all regular builtins to be callable by the exec family commands That doesn't make much sense for
|
|||
|
|

/usr/bin/cd, only the shell built-in. – Keith Thompson Oct 5 '12 at 21:03