newbie PS1 config question

Alexander Dalloz alexander.dalloz at uni-bielefeld.de
Fri Jan 30 11:18:00 UTC 2004


Am Do, den 29.01.2004 schrieb Johnathan Kupferer um 21:16:
> Niels Roetert wrote:
> 
> >On Sun, 2004-01-25 at 18:41, Ko Pu wrote:
> >  
> >
> >>PS1 question:
> >>How can I change the PS to display the current directory? According to 
> >>documentation, the \w should show the current directory, but when I used it, 
> >>it showed ~, what I'm looking for is to display info similar to pwd.
> >>
> >>prompt question:
> >>I'm using dsl modem, so the ip address is dynamic, and the prompt showed the 
> >>ip address, how can I change it to my computer name? I added it to my 
> >>/etc/host but I still got the ip address. This is what I have in my prompt.
> >>[kpu at d209-121-129-174 Linux]$
> >>
> >>Thanks in advance for your comment/suggestion
> >>
> >>Ko Fei Pu
> >>mailto:ko_pu at nospamhotmail.com
> >>    
> >>
> >
> >I always put the following line in my ~/.bashrc
> >
> >	PS1=`echo "("'${PWD}'") "`
> >
> >Works for me.
> >
> >Greeting, Niels.
> >  
> >
> 
> Took me a bit to crunch through that one...
> 
> It's equivalent to:
> 
>     PS1='(${PWD})\$ '
> 
> Which, IMHO, is quite a bit easier to read.
> 
> Cheers,
> 
> Johnathan

Or just use it like this in your ~/.bashrc:

export PS1='\n\[\033[1;34m\][\d \t]\[\033[00m\]
\[\033[1;33m\][\u@\h]\[\033[00m\] \[\033[0;36m\]<`tty | sed -e
"s:/dev/::"`>\[\033[00m\]
\[\033[0;33m\]`pwd`\[\033[00m\]\n\[\033[1;31m\]\n\W\[\033[00m\] $ '

(it's a single line)

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 1 (Yarrow) on Athlon CPU kernel 2.4.22-1.2149.nptl
Sirendipity 12:16:49 up 21:04, 7 users, 0.06, 0.14, 0.12 
                   [ Γνωθι σ'αυτον - gnothi seauton ]






More information about the fedora-list mailing list