In b shell,when su to root,the prompt is
#, but my boss need it be hostname#,
I had to export PS1=`hostname`#, but they need
when su root ,The prompt is `hostname`# sutomstically,
how can I do this ?
Thanks
su root will maintain your current environment variables
su - root will assign the root environment variables.
If you are running bourne shell then in order to assign your new prompt on each login you need to set PS1 in the .profile file in the home directory. i.e. /.profile.
Hi Mingx98, the following one-liner will solve your problem.
PS1="`hostname`#" ; export PS1
OR
you can customize it further to include some goodies such as user's ID, date, and any special character that worth dying for. e.g.
Add the above to your /etc/profile for universal/permanent implementation, or to a particular user's $HOME/.profile
FYI. if the user(s) logs in via the console, then it might be necessary to also add it to the /.dtprofile or $HOME/.dtprofile ^^^^^^^^^^^^^^^^
None is Better!
^^^^^^^^^^^^^^^^
bkonline@comcast.net
Can you clarify what exactly you want it to do? Perhaps type in an example of the su commands and what you want the prompts to look like? Annihilannic.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.