简体   繁体   中英

MacOS(Catalina) terminal bash looks weird

enter image description here

I just have installed Catalina on my imac, and I saw a terminal bash looks weird. It should be ~$ but my terminal shows ~% Can anyone change this uncommon line(~%) to a normal line(~$)? Thank you in advance

You can set your PS1 variable in your.bashrc, .bash_profile, or.profile to whatever you want. For example:

export PS1=“\h \W $ “

Will give your hostname, current working directory, followed by the $ you wanted. This can be customized however you like, see this link for a good description.

Also, as chepner mentioned in the comments, you need to set your default shell back to bash. I believe the easiest thing to do is go into your terminal settings, and change your shell:

Terminal > Preferences... > General > Shells open with: Command (complete path): /bin/bash

For a long time, the bash was a default shell in macOS. However, Apple replaced Bourne Again SHell with Z shell for licensing reasons

Set default shell to bash on Macos Catalina. The procedure is as follows:

  1. Open the terminal application.
  2. List available shells by typing cat /etc/shells.
  3. To update your account to use bash run chsh -s /bin/bash .
  4. Close terminal app.
  5. Open the terminal app again and verify that bash is your default shell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM