为什么 OSX Catalina 上带有 bash 的终端中有额外的代码行?

Why are there extra lines of code in terminal with bash on OSX Catalina?

当 运行 我的代码时,我似乎在终端中得到了很多额外的代码行。

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.

Apple 已将 bash shell 替换为 zsh shell。所以这只是系统打印出来的 I 或信息语句。如果你想使用 zsh shell 而不是旧的 bash shell 你可以按照这些步骤操作。但是,为了消除此警告并继续使用 bash 本身,您可以将此命令添加到 ~/.bash_profile 或 ~/.profile:

export BASH_SILENCE_DEPRECATION_WARNING=1

您必须使用文本编辑器打开 bash_profile 文件,添加以上行然后保存。 使用您选择的任何文本编辑器,

touch ~/.bash_profile; open ~/.bash_profile

nano ~/.bash_profile

mate ~/.bash_profile

vim ~/.bash_profile

希望这对您有所帮助。