【发布时间】:2016-04-29 23:59:32
【问题描述】:
正如问题的标题所说的那样。我的终端中有name@name-macbook-air。我想隐藏这一点。我试过了。
export PS1="\W \$" // Does not work even after restarting iterm
// this works but it always put $ but I want full path too but no username and computer name
echo "export PS1='$ '" >> ~/.bash_profile
. ~/.bash_profile
// This only put '\W' but no directory path
echo "export PS1='\W \$ '" >> ~/.bash_profile
. ~/.bash_profile
如何隐藏 name@name-macbook-air?
更新
当我执行echo $PS1 时,我会得到以下输出
%{%f%b%k%}$(build_prompt)
我正在使用 oh-my-zsh。
【问题讨论】:
-
不完全是您要查找的内容,但您可以显示
name而不是name@name-macbook-air,方法是将此行放入您的~/.zshrc:DEFAULT_USER=name,其中name == whoami
标签: macos shell terminal zsh iterm2