$cdpath
–
Directories Used by cd
$cdpath
contains the directories used as a search path by the cd
builtin command.
The linked scalar variable $CDPATH
contains the same value as a colon-separated string and
is updated at the same time when $cdpath
is modified.
Links
Examples
- Update
$cdpath
and evaluate the linked$CDPATH
- Output:
1 2 3
cdpath=(. "$HOME" /opt) echo "$cdpath" echo "$CDPATH"
1 2
. /home/user /opt .:/home/user:/opt
- Make
cd
always look into$HOME
when the directory wasn’t found in the current directory 1
cdpath=(. "$HOME")
BashSupport Pro is a Zsh IDE with support for $cdpath – try it now!