I came across this question and showing the current path after cd
is exactly what I'm looking for.
However, I can't manage to get this behavior.
What I've tried is this:
export CDPATH='.:/home/alexzeitler'
and
export CDPATH=$HOME
But after cd
, the current path is not shown.
I want to use it using bash
and zsh
and a solution without alias or function is preferred (those are known).
cd
alone without argument? That's meant to chdir() to your home directory, that's independant of$CDPATH
.$CDPATH
is only involved whencd
is given relative paths.CDPATH
as that could affect scripts that usecd
.posixcd
option in zsh for the path to be printed even by non-interactive invocations of zsh when $CDPATH is involved."%s\n", <new directory>
Otherwise, there shall be no output." Other conditions described there make it socd
without arguments would never result in outputting the directory, regardless ofCDPATH
. Of course,cd
with non-slash-prefixed arguments works; for example:cd; mkdir -p src; CDPATH=$HOME; cd src