Good evening everybody,
I like to have my prompt like that : [user@box1:/home/user]$
Therefore I had the line below in the .bash_profile file:
PS1="[$LOGNAME@`hostname`:\$PWD]\$"
Now I would like to have something like that when I log as root : [root@box1:/root]#
and adding PS1="[$LOGNAME@`hostname`:\$PWD]\#"
is definitely not working...
Any idea how to do that?
Many thanks for your help!
How do you log in to root? sudo -i
should execute your profiles
Also, I'd use PS1='[\u@\h \w]\$ '
is bash the shell for root?
I log with
su -
It is definitely a bash shell as the line
PS1="[$LOGNAME@`hostname`:\$PWD]\$"
added in the file .bash_profile in /root makes the change when I log as root.
Now If I add
PS1="[$LOGNAME@`hostname`:\$PWD]\#"
in bash_profile of root, then when I log as root it starts to show something like that :
[root@box1/root]1
if I hit enter it counts:
[root@box1/root]2
[root@box1/root]3
etc...
Anyone has a clue what's going on?
Many thanks,
yes. the "#" doesn't need escaped. bash prompts have different meanings for escaped sequence. \#
actually means "Command number"
\$
will turn into $ for user and # for root. So the ideal solution is to use PS1='[\u@\h:\w]\$ '
[/FONT]
Many thanks
PS1="[$LOGNAME@`hostname`:\$PWD]#"
works fine!
For info :
PS1="[$LOGNAME@`hostname`:\$PWD]\$"
Shows something like that:
[root@box1/root]$
even as root.
Thanks again for your help!!!