我可以像这样打印我当前的工作目录
myPrompt$ pwd
/Users/me/myDir
Run Code Online (Sandbox Code Playgroud)
我希望我的外壳看起来像这样
/Users/me/myDir$ pwd
/Users/me/myDir
Run Code Online (Sandbox Code Playgroud)
那可能吗?我该怎么做?
Gil*_*il' 61
把它放在你的~/.bashrc:
PS1='\w\$ '
Run Code Online (Sandbox Code Playgroud)
这是 OSX 的单线。它将您想要的提示附加到配置文件中,然后重新加载配置文件。
echo "PS1='\w\$ '" >> ~/.bash_profile; source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
在 El Capitan,你会想要使用
echo "PS1='\w\$ '" >> ~/.profile; source ~/.profile
Run Code Online (Sandbox Code Playgroud)