1748078 Members
5399 Online
108758 Solutions
New Discussion юеВ

setting user prompt

 
SOLVED
Go to solution
mw_4
Frequent Advisor

setting user prompt

/bin/bash shell
user@host[pwd]
pwd is full path can anyone help me...?
Step by step
3 REPLIES 3
I_M
Honored Contributor

Re: setting user prompt

Hi

I am using RH7.3.
The default prompt is [user@host dir]$.

Then I checked out "echo $PS1".
[\u@\h \W]\$

So I want to change my prompt something like yours, I set my PS1 as,

PS1=\\u@\\h[\\W]\$

Of course you have to put this command into your .bash_profile or .bashrc in your home directory.

Good luck
Kodjo Agbenu
Honored Contributor
Solution

Re: setting user prompt

Hello,

Try :

export PS1="`whoami`@`hostname`[\$PWD] "

Good luck.

Kodjo
Learn and explain...
Stuart Browne
Honored Contributor

Re: setting user prompt

The token for the 'full path' (as against just the last dir in path) is \w, not \W.

so:

PS1='\u@\h[\w]\$ '

This is covered in 'man bash', under the section 'PROMPTING'.
One long-haired git at your service...