I want to use bash's CDPATH
to point to a directory of symlinks to directories that I access frequently. However, doing:
CDPATH="~/symlinks"
causes cd SUBDIR
to stop working if ./SUBDIR
and ~/symlinks/SUBDIR
both exist; CDPATH
directories take precedence over the current working directory.
I tried to fix this by instead using:
CDPATH=".:~/symlinks"
and that does fix the precedence problem, but now cd
ing to a subdirectory always prints its full path:
$ pwd
/foo/bar
$ cd baz
/foo/bar/baz
This is a bit annoying. I know that I can suppress all cd
output by doing alias cd='> /dev/null cd'
, but I do like the path being printed for other CDPATH
entries (or when doing cd -
). Is there anything better that I can do?