Re: How to show the real directory instead of "~" (=HomeDir) in prompt pattern ?



On Friday 02 June 2006 15:49, Stephen Neal stood up and spoke the
following words to the masses in /comp.os.linux.misc...:/

Ok, I could define a new prompt with

export PS1='\h:\w> '

but whenever I am in my home directory the directory name is replaced
by a "~" How can I force Linux to show the full directory name in this
case as well ?

You can use *\W* instead of *\w* for the basename of the directory, but
I personallly use *\$PWD* in my command prompt.

It displays the complete path to the working directory, which may turn
out a little too wide if you're working at a deeply nested level, but I
have my consoles use a 1600*1200 pixel resolution - i.e. 200x75
characters - via the framebuffer.

I've put the following in my */etc/bashrc,* which makes it systemwide -
just try it in a terminal window and see whether you like it...: ;-)

PS1="\n[\d - \t][\h:\$PWD]\n[vc/\l - \u] \\$> "

The dollar sign will also change to a "#" when you're logged in as - or
/su'ed/ to - the root account. ;-)

Lastly, there are also a couple of very elaborate /Bash_Prompt_HowTo's/
with numerous examples on...

http://www.tldp.org

.... if you want a more sophisticated prompt. ;-)


--
With kind regards,

*Aragorn*
(Registered GNU/Linux user #223157)
.



Relevant Pages

  • Re: Working Directory?
    ... > ADUC on the 'profiles' tab so I'm not sure why the working directory would ... Perhaps because the shortcuts for Command prompts are coded ... You could to just change all the command prompt ... Accelerated MCSE ...
    (microsoft.public.windows.server.active_directory)
  • Re: Executing a command in sub-shell
    ... After this point i should be into the command prompt and not execute ... Only when i type exit from the command prompt then i should go into ... Working directory view: ** NONE ** ... here the value of val1 is not printed ?? ...
    (comp.unix.shell)
  • Re: Default IRB Directory
    ... Irb is an interpreter console. ... If you start it from the command prompt then the current directory ... shortcut then you can define the "Start in" or working directory. ...
    (comp.lang.ruby)

Loading