简体   繁体   English

MacBook Pro ZSH 终端提示

[英]MacBook Pro ZSH terminal prompt

Hope someone would help.希望有人会帮忙。 Bought new MacBook Pro 2020 yesterday and it has ZSH by default not bash and $ sign also disappeared.昨天买了新的 MacBook Pro 2020,默认情况下它有ZSH ,而不是bash ,$ 符号也消失了。 I can see there are two files in bin folder which are bash and zsh.我可以看到 bin 文件夹中有两个文件,分别是 bash 和 zsh。

Is there any way I can get rid of MBP in my prompt and change my prompt name and also get back $ sign as well?有什么方法可以在我的提示中摆脱 MBP 并更改我的提示名称并取回 $ 符号? please see attached pic what I am talking about.请看附件图片我在说什么。 终端形象

Update更新

I managed to change prompt by making a new file .zshrc in home dir and adding prompt properties PROMPT='%(?.%F{green}Azam.%F{blue}?%?)%f %B%F{240}%0~%f%b %#' .我设法通过在主目录中创建一个新文件 .zshrc 并添加提示属性PROMPT='%(?.%F{green}Azam.%F{blue}?%?)%f %B%F{240}%0~%f%b %#' Now my prompt looking fine but its output ?127 when command not found .现在我的提示看起来不错,但它的输出?127 when command not found Please let me know how I can fix this so it should drop back to default prompt?请让我知道如何解决此问题,以便它返回到默认提示? 新的命令提示符图片

# without color
export PS1='%n %~ %(!.#.$) '

# with color
export PROMPT='%(?.%F{green}%n.%F{blue}?%?)%f %B%F{240}%~%f%b %(!.#.$) '

# remove return value (like 127) from prompt
export PROMPT='%F{green}%n%f %B%F{240}%~%f%b %(!.#.$) '

PS1 is equivalent to PROMPT in zsh. PS1相当于 zsh 中的PROMPT Use whichever you want.使用任何你想要的。

References参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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