踩过了坑,就让后来者少一些困惑。
要想实现狗皮膏药的这种效果
user@
localhost:
pwd
Mac神器Iterm2的Shell Integration
注意项一:
curl -L https://iterm2.com/misc/install_shell_integration.sh | bash
在服务器和本机都要执行这条命令,或者是通过“Iterm2"->"Install Shell Integration"来执行这条命令,执行完毕之后,会发现无论是服务器、还是本机在“命令提示符”最前面有一个蓝色的小三角块(When shell integration is enabled, iTerm2 automatically adds a mark at each command prompt. Marks are indicated visually by a small blue triangle in the left margin.)
hostname -f
对于没有hostname的,在bash_profile里面这样处理:
show_hostname() {
echo "kisops.com"
}
alias hostname=show_hostname
在profile badge里面填上:
\(session.username)@\n\(session.hostname):\n\(session.path)
效果就出来了,就是这么简单。