Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I can print my current working dir like this
I want my shell to look like this
Is that possible? How can I do it?
You can use escape sequences in prompt variables.
Put this in your ~/.bashrc:
Here's a one-liner for OSX. It appends the prompt you want into the profile file and then reloads the profile.
echo "PS1='\w\$ '" >> ~/.bash_profile; source ~/.bash_profile
On El Capitan you'll want to use
echo "PS1='\w\$ '" >> ~/.profile; source ~/.profile
For some reason '\w\$' didn't work for me but instead I did: export PS1="$(pwd) \$" and it worked.
export PS1="$(pwd) \$"
Looks like an old thread but the steps below worked for me on OS X 10.9.5
Required, but never shown