Strange behaviour of the "cd" command
Dr Rainer Woitok
rainer.woitok at gmail.com
Wed Jul 12 09:23:28 UTC 2017
Joel,
On Tuesday, 2017-07-11 10:51:53 +0900, you wrote:
> ...
> > $ echo $SHELL
> > /usr/bin/ksh
> > $ unset CDPATH
> > $ ls -la / | head -4
> > total 116
> > drwxr-xr-x 24 root root 4096 2017-06-26 19:05 .
> > drwxr-xr-x 24 root root 4096 2017-06-26 19:05 ..
> > drwx------ 2 root root 4096 2016-05-25 11:19 .cache
> > $ cd /.cache
> > /usr/bin/ksh: hist[7]: cd: /.cache: [Permission denied]
> ...
> Having a /.cache might indicate that something succeeded half-way
> at su-ing to root without enough permission to read root's login directory,
> or something like that.
You might well be right. But for the case at hand it doesn't matter. I
just used this directory as a guinea pig to demonstrate the problem.
> ...
> I made a /.cache directory, just for grins, but I don't reproduce this. My
> shell is bash.
But as one can see from the output of "echo $SHELL" above, I used a Korn
Shell. And since the "cd" command is a shell built-in, I'm not surpris-
ed you can't reproduce the problem using a Bash Shell.
> ...
> Check whether you have an executable called "cd" somewhere in
> your PATH. (You shouldn't, of course.)
I haven't, of course. But you're right, I should have added the command
"whence cd" to the problem description.
Sincerely,
Rainer
More information about the ubuntu-users
mailing list