MacOS(Catalina) 终端 bash 看起来很奇怪

MacOS(Catalina) terminal bash looks weird

enter image description here

我刚刚在我的 imac 上安装了 Catalina,我看到一个终端 bash 看起来很奇怪。 它应该是 ~$ 但我的终端显示 ~% 谁能把这个不常见的行(~%)改成普通的行(~$)? 提前谢谢你

您可以将 .bashrc、.bash_profile 或 .profile 中的 PS1 变量设置为您想要的任何值。例如:

export PS1=“\h \W $ “

将提供您的主机名、当前工作目录,然后是您想要的 $。这可以根据您的喜好进行自定义,请参阅 this link 了解详细说明。

此外,正如 chepner 在评论中提到的,您需要将默认 shell 设置回 bash。我相信最简单的方法是进入终端设置,然后更改 shell:

Terminal > Preferences... > General > Shells open with: 命令(完整路径):/bin/bash

长期以来,bash 是 macOS 中的默认值 shell。但是,出于许可原因,Apple 将 Bourne Again SHell 替换为 Z shell

在 Macos Catalina 上将默认 shell 设置为 bash。程序如下:

  1. 打开终端应用程序。
  2. 通过键入 cat /etc/shells.
  3. 列出可用 shells
  4. 更新您的帐户以使用 bash 运行 chsh -s /bin/bash
  5. 关闭终端应用程序。
  6. 再次打开终端应用程序并确认 bash 是您的默认值 shell。