Thread: Prompt \w gives relative path

  1. #1
    Registered User
    Join Date
    Feb 2009

    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


    while i want it to be like


    Where am I making the mistake?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    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.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    okay, let's try that again. . . you'd want to put this in (somewhere)
    PS1="\${PWD}# "
    and the best thing to do is to try it out first via export PS1="\${PWD}# "

Popular pages Recent additions subscribe to a feed

Similar Threads

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