user3299633
user3299633

Reputation: 3390

MAC OS prompt won't change to show my full path

I have the following in my .bash_profile:

PS1='\h:\w$ '

But my prompt looks like this:

laptop:~$

What setting do I need to modify so that the "~" instead prints out the correct path... in this instance it should be /Users/jay/

The jay account is the default user, so is there a way to change this?

Upvotes: 0

Views: 2437

Answers (1)

Adil Hindistan
Adil Hindistan

Reputation: 6635

This is expected. Tilde is a very well known shorthand for active user's home folder. If you look at the help for Bash

man bash

and then type ( you may need to hit 'n' key a couple of times to get to the section about PROMPTING)

/PROMPTING

You will notice that it says

\w     the current working directory, with $HOME abbreviated with a tilde
\W     the basename of the current working directory, with $HOME abbreviated with a tilde

That being said, if you really want it to print the full path instead, you can use another variable: $PWD (Peek Working Directory) to replace your \w or \W

So, type:

echo $PS1

If for example that returns

\h:\W \u\$

Type

PS1='\h:$PWD \u\$ '

That should change it (it works on my 10.11)

Upvotes: 5

Related Questions