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

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 是一款支持 chpwd_functions** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款