LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-04-2007, 04:07 PM   #1
tschima
Member
 
Registered: Apr 2006
Location: Wisconsin
Distribution: LinuxMint, knoppix, Solaris
Posts: 109

Rep: Reputation: 15
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
 
Old 07-04-2007, 05:37 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

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

PS1='${PWD}\$ '

or

PS1='$(PWD)\$ '

Last edited by jschiwal; 07-04-2007 at 05:41 PM.
 
Old 07-05-2007, 08:03 PM   #3
tschima
Member
 
Registered: Apr 2006
Location: Wisconsin
Distribution: LinuxMint, knoppix, Solaris
Posts: 109

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
correct DISPLAY setting mathfeel Linux - Software 2 05-26-2006 03:15 PM
redirecting the output of pwd into konqueror as a url. using bash fiery_ice Linux - Newbie 5 04-05-2006 04:13 PM
reset pwd to root's current pwd? ataraktos2 Linux - General 10 04-26-2005 05:13 AM
getting custom PWD in bash prompt techrolla Linux - Software 2 08-09-2004 01:39 AM
PC Display Not Correct Mal495 Linux - Newbie 1 10-30-2003 11:08 PM


All times are GMT -5. The time now is 01:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration