C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-25-2009, 10:57 AM   #1
Registered User
 
Join Date: Feb 2009
Posts: 10
Prompt \w gives relative path

When I use \w to set my prompt in bashrc (using ubuntu, if it makes a difference)

it shows prompt as

~/sources
vivek-laptop:vivek

while i want it to be like

/home/vivek/sources
vivek-laptop:vivek

Where am I making the mistake?
vkaushal21 is offline   Reply With Quote
Old 09-25-2009, 11:44 AM   #2
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,944
That is not a relative path. The tilde (~) is your home directory. Eg, if you log in as root and go to the same place, you will see /home/vivek, since ~ for root is (usually) /root.

I don't think you would be using the bash prompt in this way, but generally if you need to replace a ~ which has been output it is equal to the $HOME environment variable.
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS
MK27 is offline   Reply With Quote
Old 09-25-2009, 01:09 PM   #3
Jaxom's & Imriel's Dad
 
Kennedy's Avatar
 
Join Date: Aug 2006
Location: Alabama
Posts: 801
okay, let's try that again. . . you'd want to put this in (somewhere)
Code:
PS1="\${PWD}# "
and the best thing to do is to try it out first via export PS1="\${PWD}# "
Kennedy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Buidl Library with ./configure script Jardon C Programming 6 07-24-2009 09:36 AM
How to judge whether a path is relative or absolute? bbebfe C Programming 2 11-16-2008 03:23 AM
MSVC: output .pd under relative path? pheres Windows Programming 0 02-04-2008 10:55 AM
Path of file relative to program ulillillia C Programming 13 04-15-2007 05:30 AM
linked list recursive function spaghetti ... C++ Programming 4 09-02-2003 02:53 PM


All times are GMT -6. The time now is 03:44 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22