[英]Bash event handler for current working directory change
Bash 中是否有一种简单的方法来检测当前工作目录的更改? 每次使用cd
命令导航时,我都想更改窗口标题。 我想在控制台窗口的标题中包含存储库的目录名称。 如果 CWD 不是存储库,则标题可以为空。
例如:
cd Documents/Repositories # after this line I want window title to be empty ''
cd repository1 # after this line I want window title to be 'repository1'
cd .. # after this line I want window title to be empty ''
cd repository2 # after this line I want window title to be 'repository2'
有没有办法检测 CWD 何时发生变化(有点像事件处理程序)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.