Strange behaviour of the "cd" command

Dr Rainer Woitok rainer.woitok at gmail.com
Wed Jul 12 10:09:01 UTC 2017


Ken,

On Tuesday, 2017-07-11 13:39:21 -0400, you wrote:

> ...
> $ mkdir ../../three
> $ cd ../../.three
> $ pwd
> /tmp/three

Congrats back to you :-)

I hadn't yet found this one.   But this clearly indicates  that the Korn
Shell's built-in "cd" command is really dropping the dot from the relat-
ive path  in this case.   By pure chance  I meanwhile happened to find a
workaround.  Slightly changing your last two commands above yields

   $ cd ../..//.three
   $ pwd
   /tmp/.three

Thus duplicating the slash preceeding the dot  prevents the dot from be-
ing dropped.  Just to add some more information I have forgotten to pro-
vide in my original post:

   $ echo $KSH_VERSION
   Version AJM 93u+ 2012-08-01

And as an aside, I also have a Korn Shell running on a Windows box under
Cygwin which does NOT  exhibit the  strange behaviour  described in this
thread.   This one has a value of "@(#)MIRBSD KSH R54 2016/11/11" stored
in shell variable "KSH_VERSION", making it considerably more recent.

What now?  Are there any Korn Shell developers or maintainers listening?

Sincerely,
  Rainer




More information about the ubuntu-users mailing list