Hook function when the working directory is changed
chpwd
is called when the current working directory is changed.
Array variable chpwd_functions
can be used to declare additional hook functions.
Links
Examples
- Echo new working directory to STDERR and STDOUT
- Output:
1 2 3 4 5 6
chpwd() { echo "Working dir (STDOUT): $PWD"; } chpwd_stderr() { echo "Working dir (STDERR): $PWD" >&2; } chpwd_functions=(chpwd_stderr) cd ~
1 2
Working dir (STDOUT): /home/user Working dir (STDERR): /home/user
BashSupport Pro ist eine Zsh IDE mit Unterstützung für chpwd - probieren Sie es jetzt aus!