试图在终端中设置完整的目录路径,但是在〜/ .zshrc中无法识别\ u

时间:2016-07-20 18:41:50

标签: shell unix zsh

我尝试按照以下链接中的建议设置终端显示的完整目录路径,并通过添加以下行修改了〜/ .zshrc。在源〜/ .zshrc之后,看起来zshrc无法识别\ u,\ H,\ w。

https://superuser.com/questions/239994/how-to-have-full-directory-path-always-shown-in-mac-terminal-like-linux-termina

那我该怎么办呢?

Added this line into ~/.zshrc:
    export PS1='\u@\H [\w]$ '
The terminal looks like:
    \u@\H [\w]$ 

1 个答案:

答案 0 :(得分:1)

使用PROMPT变量(http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html)和%n,%m和%d:

PROMPT='%n@%m [%d]$ '