/usr/bin/cd (was Re: sudo cd command doesn`t appear to work.)
mlh at zip.com.au
Thu Aug 1 01:08:52 EDT 2002
On Wed, Jul 31, 2002 at 09:59:44PM -0700, Howard Owen wrote:
> Well, not exactly. With bash, at least, 'cd' is a shell builtin. It makes
> that this would be so, since a subshell cannot, indeed, affect the
> environment of
> its parent. So cd has to be a builtin so that the CWD of the current shell
> can be
> changed. This causes problems for sudo, since there's no '/bin/cd' command
> to run.
> cd /tmp
> ^^ shell intercepts 'cd' command
> sudo cd /tmp
> ^^ shell does nothing special with second arg.
[ ... ]
This may be tangential to tcurrent thread, but, sadly,
there IS a /usr/bin/cd command on POSIX standard systems.
It's perfectly useless, of course, and can make things even
worse (more complex) for commands like sudo.
More information about the sudo-workers