Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Oct 2001 20:34:56 +1000
From:      syncman@ihug.com.au
To:        Kelvin Ng Chee Hoong <nchee_hoong@pacific.net.sg>
Cc:        questions@freebsd.org
Subject:   Re: Change Prompt 
Message-ID:  <3BD9C8F0.9313.25CFA56@localhost>
In-Reply-To: <5.1.0.14.0.20011026173002.00a44de0@po.pacific.net.sg>

next in thread | previous in thread | raw e-mail | index | archive | help
 > Hi ;
 > I use bash shell in my FreeBSD machine . How do I change a promt from
 > "$" to "#" when I login as superuser from normal user to root ?
 >
 >
 > my .bashrc script looks as following .....
 >
 > PS1="[\u@\h: \w]\$ "
 > alias ls='ls -F'
 > alias cp='cp -i'
 > alias mv='mv -i'
 > alias rm='rm -i
 >
 >
 > Another question , what is the function of PS2 and when to use it ? 
Please
 > advise ....

Hi Kelvin,

Bash automatically expands "\$" in PS{1,2} to "#" for user ID 0 and "$" 
for any other user ID.

PS2 is used when additional input is needed from the user, such as in the 
following example:

  syncman@viper ~$ echo PS2=\'$PS2\'
  PS2='> '
  syncman@viper ~$ for x in hello world
  > do echo $x
  > done
  hello
  world
  syncman@viper ~$ 

See the PROMPTING section in the bash(1) manual page for more information.

        - Syncman.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BD9C8F0.9313.25CFA56>