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

Volker Wysk post at volker-wysk.de
Fri Jul 3 08:56:40 UTC 2020


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.
> 
> If you do a cd to an absolute path it outputs nothing but if you cd
> to
> a relative path it outputs (i.e. does a pwd) the path after changing
> directory.
> 
> For example:-
> 
>     chris$ cd
>     chris$ cd /tmp
>     chris$ cd scans
>     /tmp/scans
>     chris$ 

I can't reproduce this. It doesn't output the new path on my machine:

desktop ~ $ mkdir /tmp/scans
desktop ~ $ cd /tmp
desktop /tmp $ cd scans
desktop /tmp/scans $ 


Bye
Volker





More information about the ubuntu-users mailing list