$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.

Examples

Update $cdpath and evaluate the linked $CDPATH
1
2
3
cdpath=(. "$HOME" /opt)
echo "$cdpath"
echo "$CDPATH"
Output:
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 ist eine Zsh IDE mit Unterstützung für $cdpath - probieren Sie es jetzt aus!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches