'cd' does 'pwd' with relative path but not with absolute path - documented?

Karl Auer kauer at biplane.com.au
Fri Jul 3 09:19:32 UTC 2020


On Fri, 2020-07-03 at 10:56 +0200, Volker Wysk wrote:
> Am Freitag, den 03.07.2020, 09:28 +0100 schrieb Chris Green:
> > I have only recently noticed that when running bash in a terminal
> > 'cd' acts differently for relative and absolute paths.

This probably means that you have CDPATH set. Read what "man bash" has
to say about cd, and I think you'll find your answer. This is the
effect:

kauer at kt1:~/dev/temp$ pwd
/home/kauer/dev/temp
kauer at kt1:~/dev/temp$ ls -lad temp
drwxrwxr-x 9 kauer kauer 4096 Jun  4 10:48 temp
kauer at kt1:~/dev/temp$ cd temp
kauer at kt1:~/dev/temp/temp$ cd ..
kauer at kt1:~/dev/temp$ export CDPATH=.
kauer at kt1:~/dev/temp$ cd temp
/home/kauer/dev/temp/temp

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
Old fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D





More information about the ubuntu-users mailing list