【发布时间】:2022-01-07 16:34:20
【问题描述】:
根据对 Monterey 的 Mac OS 更新,它表明新的 shell 是 ZSH:
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
更新后我意识到.bash_profile 不再使用。经过研究,我发现我可以引用.bash_profile,所以我仍然可以使用我的别名来添加以下行:
source ~/.bash_profile
我发现终端的不同之处在于它不使用PS1,而是使用PROMPT。更改后:
export PS1='vader ~/${PWD/*\/} '
到
PROMPT='vader %~%# '
它呈现完整路径。在.zshrc 文件中,如何指定仅呈现当前目录或basename 的能力,所以如果我有github/project/node_modules 的路径,终端将是:
vader ~/node_modules%
【问题讨论】: