How to change the shell prompt to indicate pwd?

Using applications, configuring, problems
Post Reply
Message
Author
Black Hawk
Posts: 7
Joined: Mon 06 Aug 2007, 08:54

How to change the shell prompt to indicate pwd?

#1 Post by Black Hawk »

I want to change the shell prompt in rxvt from
sh-3.00# to somthing which tells me which directory I'm working in. I've tried putting export PS1="\u@\h:\w\# " in /root/.bashrc, but I coun't get it to work.

Any help is appriciated

Thanks

Leachim
Posts: 229
Joined: Sun 27 May 2007, 23:04

#2 Post by Leachim »

It might help to add

-e bash

to "Arguments to pass" in the "Edit Item"-Dialog of your console-icon. Don't ask me, what gets executed if you don't specify this option!

Black Hawk
Posts: 7
Joined: Mon 06 Aug 2007, 08:54

#3 Post by Black Hawk »

The command itself works, but when I add it to the argument thing, rxvt refuses to start. Does anyone know how to fix this?

Leachim
Posts: 229
Joined: Sun 27 May 2007, 23:04

#4 Post by Leachim »

Hmm - which window manager are you using? I use icewm - maybe the settings are different for other window managers ...

My settings for the console icon:

Code: Select all

Clicking the icon opens:

/usr/bin/rxvt

Arguments to pass (for executables):

-e bash

The text displayed under the icon is:

console
I added the -e bash myself. Before I did this my .bashrc wasn't executed, too!

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#5 Post by Dougal »

You should try changing the prompt export in /etc/profile
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

brahmy
Posts: 1
Joined: Mon 03 Sep 2007, 21:52

#6 Post by brahmy »

Dougal wrote:You should try changing the prompt export in /etc/profile
I was just searching for this and this is the answer. There is a line in /etc/profile that reads

Code: Select all

PS1="# "
I replaced it with

Code: Select all

# set prompt: ``username@hostname:/directory $ ''
PS1="[\u@\h:\w] " 
case `id -u` in
      0) PS1="${PS1}# ";;
      *) PS1="${PS1}$ ";;
esac
Which I found here. Still not sure if it can tell the difference between root and users, I have to play around with that some more. But from what I've read rxvt is basically bash so all the same commands should work (wrt to prompt).

Bruce B

#7 Post by Bruce B »

Black Hawk wrote:The command itself works, but when I add it to the argument thing, rxvt refuses to start. Does anyone know how to fix this?
In /root/.bashrc add this line, I call the prompt my OS2 prompt.

Code: Select all

PS1="[\w] "
Open /etc/profile make sure that these two lines are NOT commented out.

Code: Select all

SHELL="/bin/bash"                                                              
export SHELL

User avatar
willhunt
Posts: 495
Joined: Wed 05 Oct 2005, 18:19

#8 Post by willhunt »

here is some great prompt stuff hope it helps
http://www.murga-linux.com/puppy/viewto ... 512#121512
[url=http://hostfile.org/icepak.pet]176 Icewm Themes :!:[/url]
[url=http://tinyurl.com/39fl3x]vlc-0.8.6c-i586.pet[/url]
[url=http://tinyurl.com/2q7cbp]vlc-0.8.6c-i586.pet[/url]

Post Reply