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.

Examples

Echo new working directory to STDERR and STDOUT
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 ~
Output:
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!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches