Solaris10 root prompt

I am trying to figure how change the prompt to display the machine's hostname when logged in as root. See the out below as a user and as root. What files I need to change to dispaly the hostname of the machine as the root user?
Please Help

roger@bmt-S10:[~] $ id
uid=101(roger) gid=14(sysadmin)
roger@bmt-S10:[~] $ su -
Password:
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
# bash
bash-3.00# id
uid=0(root) gid=0(root)
bash-3.00#
1badabingAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VenabiliCommented:
You need to set the bash prompt. The variable name is PS1

http://docs.sun.com/app/docs/doc/806-7612/6jgfmsvrq?a=view has the exact synatx.
VenabiliCommented:
To make the change permanent just export the variable from your profile file.
VenabiliCommented:
(pressed Submit too fast)

If  you just want the host name
PS='\h#' or \H# should be enough - the capital letter one will get your FQDN if it can, the small one gets the hostname to the first dot. See httphttp://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-2.html for all available options)
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

VenabiliCommented:
Make that PS1='\h#'

Sorry for the multiposting
TintinCommented:
vi $HOME/.bash_profile

and set

export PS1='\h# '
kirubaharanCommented:
Its simple try this....

PS1="`hostname`: "

Just see sun document for more info.

http://docs.sun.com/app/docs/doc/806-7612/6jgfmsvrq?a=view
VenabiliCommented:
I just love when people post already posted links ;)
1badabingAuthor Commented:

How can I  "export the variable from username profile file" to the root user?

roger@bmt-S10:[~] $ env
LC_MONETARY=en_US.ISO8859-15
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=192.168.2.4 1970 22
LC_NUMERIC=en_US.ISO8859-15
SSH_TTY=/dev/pts/2
USER=roger
MAIL=/usr/mail/roger
PATH=/usr/bin:/usr/sbin:/usr/ucb:/etc:/usr/sbin:
LC_MESSAGES=C
LC_COLLATE=en_US.ISO8859-15
PWD=/export/home/roger
TZ=US/Eastern
PS1=\u@\h:[\w] $
SHLVL=1
HOME=/export/home/roger
LOGNAME=roger
SSH_CONNECTION=192.168.2.4 1970 192.168.2.5 22
LC_CTYPE=en_US.ISO8859-1
LC_TIME=en_US.ISO8859-15
_=/usr/bin/env
roger@bmt-S10:[~] $ su -
Password:
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
#
#
# env
HOME=/
HZ=
LC_COLLATE=en_US.ISO8859-15
LC_CTYPE=en_US.ISO8859-1
LC_MESSAGES=C
LC_MONETARY=en_US.ISO8859-15
LC_NUMERIC=en_US.ISO8859-15
LC_TIME=en_US.ISO8859-15
LOGNAME=root
MAIL=/var/mail/root
PATH=/usr/sbin:/usr/bin
SHELL=/sbin/sh
TERM=xterm
TZ=US/Eastern
#
#
# bash
bash-3.00#
bash-3.00#
bash-3.00# env
HZ=
LC_MONETARY=en_US.ISO8859-15
TERM=xterm
SHELL=/sbin/sh
LC_NUMERIC=en_US.ISO8859-15
PATH=/usr/sbin:/usr/bin
MAIL=/var/mail/root
LC_MESSAGES=C
LC_COLLATE=en_US.ISO8859-15
PWD=/
TZ=US/Eastern
SHLVL=1
HOME=/
LOGNAME=root
LC_CTYPE=en_US.ISO8859-1
LC_TIME=en_US.ISO8859-15
_=/usr/bin/env
bash-3.00#
VenabiliCommented:
See the comment from Tintin for example.
Or check any of the links posted above
Joseph GanSystem AdminCommented:
For bash, put everything you like from user's .profile to /etc/profile. So when anyone logs onto the server, the variable in /etc/profile will be set before the .profile. But root dosen't have a .profile, only uses /etc/profile.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RowleyCommented:
Examples may help. I like to use this:

myhost=`uname -n`
PS1='$LOGNAME@$myhost $PWD $ '
export myhost PS1
1badabingAuthor Commented:
Thank you folks
TintinCommented:
You need to be careful with what you put in /etc/profile as it is referenced by bash, ksh and sh.

Just make sure you put portable code in there.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.