LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File that defines root command prompt? (https://www.linuxquestions.org/questions/linux-newbie-8/file-that-defines-root-command-prompt-35979/)

WeNdeL 11-20-2002 11:08 AM

File that defines root command prompt?
 
For RH 7.2:

what file is it that defines the default root command prompt?

I know you can modify the .bashrc file to alter this but I wanted to look at what makes up the root user's command prompt....

more specifically, what is it that displays the "#' or "$" symbol depending on what type of user you are...

I have tried \$ but this is reversed from what it should be.... when I say should be I mean:

# for root
$ for any other user (i believe)

thx in advance... :Pengy:

acid_kewpie 11-20-2002 11:24 AM

that prompt itself is defined by the PS1 variable:

echo $PS1

WeNdeL 11-20-2002 11:31 AM

ok.... I knew that but didn't think to look at where that variable was defined...

thx!

acid_kewpie 11-20-2002 11:34 AM

normally a default is provided in /etc/bashrc, otherwise in ~/.bashrc as you already said.

WeNdeL 11-20-2002 11:40 AM

my problem was this:

i had changed my PS1 to be this:

PS1="\u@\h \w\n\$ "

but this was needed to produce the desired effect:

PS1="\u@\h \w\n\\$ "

I have read about why this happens but just forgot... :tisk:

KevinJ 11-20-2002 11:48 AM

there is a bash shell variable called "PS1"

"echo $PS1" to see what it is now, then change the symbol at the end

Example:

[root@cxo336745ew sysconfig]# echo $PS1
[\u@\h \W]\$

Note: There is a "\" before the $ because its an escape character.

[root@cxo336745ew sysconfig]# PS1="[\u@\h \W]% "
[root@cxo336745ew sysconfig]%

Then you can put it in your .bashrc file


-K.

WeNdeL 11-20-2002 12:28 PM

Re: File that defines root command prompt?
 
:D thx!


All times are GMT -5. The time now is 09:33 PM.