How to fix Mac terminal username format (missing colon and no spacing after the $)?

走远了吗. 提交于 2019-12-13 04:25:18

问题


I get a wrong username format when I launch my terminal. As a newbie, I could notice three errors: 1. a closed bracket ] appears instead of a colon 2. the $ sign is not followed by a single space 3. the first letter or character typed doesn't appear, for e.g. if I type ls, only the s would appear

Username: mymac, Computer name: MyMac’s MacBook Air


This is a screenshot


回答1:


The extra ] can be disabled by :

  1. opening the terminal
  2. selecting edit menu bar
  3. hovering over marks
  4. unchecking automatically mark prompt lines

The default can be overridden by executing the following command:

echo 'export PS1="\\u@\h \W $ "' >> ~/.bash_profile

Reference: https://superuser.com/questions/974714/previous-commands-wrapped-with-square-brackets-in-os-x-terminal



来源:https://stackoverflow.com/questions/57626014/how-to-fix-mac-terminal-username-format-missing-colon-and-no-spacing-after-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!