$chpwd_functions
–
Additional hook functions when the working directory is changed
Function chpwd
is called when the current working directory is changed.
The 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 is a Zsh IDE with support for $chpwd_functions – try it now!