LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Bash Prompt - display correct $(pwd) (http://www.linuxquestions.org/questions/linux-general-1/bash-prompt-display-correct-%24-pwd-566657/)

tschima 07-04-2007 03:07 PM

Bash Prompt - display correct $(pwd)
 
When I use $(pwd) in my PS1, whatever the current working dir, the prompt always displays /home/username. However, when I use the \w, I always get the ~ tilde indicating the home dir. Is there a way to get the prompt to indicate that the home dir is /home/username, but always update to display the correct cwd in the prompt? Also, the \W (as opposed to the lowercase \w) doesn't give the whole cwd. Thanks.

Terry

jschiwal 07-04-2007 04:37 PM

Use single quotes around the prompt so it isn't evaluated before being assigned to PS1

PS1='${PWD}\$ '

or

PS1='$(PWD)\$ '

tschima 07-05-2007 07:03 PM

Bash Prompt - display correct $(pwd)
 
Thanks,

Well, I tried '$(pwd)' and '$(pwd)\$' and it does display the correct current dir, but it also displays the single quotes. I am using bash 2.0.5.08 on RH 7.2 (This is a P1/100 box). I suppose that could have an affect.

Terry


All times are GMT -5. The time now is 08:16 AM.