- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: changing command prompt dynamically
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 11:14 AM
тАО03-29-2006 11:14 AM
I have put the below line in my .profile.
export PS1="[`whoami`@`hostname`:`echo '$PWD'`]$ "
When i become root user i want to change the dollar prompt to "#"
Can someone suggest how to do it ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 11:20 AM
тАО03-29-2006 11:20 AM
Re: changing command prompt dynamically
I think i didnt understand correctly..
1. When you become root user your prompt will surely change from $ to #, isn't that happening right now for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 11:20 AM
тАО03-29-2006 11:20 AM
Re: changing command prompt dynamically
IF you 'su' from your login account to root and do:
# su root
...then 'root's profile is not read and you will not see any change in your PS1 prompt.
If, on the otherhand you do:
# su - root
...then whatever the PS1 prompt is defined as in the '.profile' for 'root' is honored. By default, this will be a "#".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 11:41 AM
тАО03-29-2006 11:41 AM
Re: changing command prompt dynamically
Thanks,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 11:48 AM
тАО03-29-2006 11:48 AM
Re: changing command prompt dynamically
You said, "I become root by typing "$pbrun ksh". Shiv, unless you use 'su' to switch users and cause your profile to be sourced (read) you will need to provide substantially more information.
First, I am assuming that you are using the standard Poxix shell. Are you? Otherwise, you will need to change the "$pbrun" object to assign "#" to the PS1 environmental variable and export it when run.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 12:04 PM
тАО03-29-2006 12:04 PM
Re: changing command prompt dynamically
"SHELL=/usr/bin/ksh". It means it is not posix shell. It has been set as korn shell.
Whenever i am logged in as normal user the command prompt should show "[sksonkar@servername:/home/sksonkar]$" and when i become privilaged user by typing $pbrun ksh it should change to "[sksonkar@servername:/home/sksonkar]$".
As i navigate to other directories the name of directory on the prompt should show the current one.
Regards,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 12:38 PM
тАО03-29-2006 12:38 PM
Re: changing command prompt dynamically
As I said, the only way that you are going to transition to being a "superuser" is to execute an 'su' command.
I hope that there is only onle superuser (uid=0) on your server and that that is named "root" and has a default shell of '/sbin/sh' (the static Posix one!).
It would help greatly if you would post the 'pbrun' source, assuming that it is a command text file of some sort and not a binary.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-02-2006 05:27 PM
тАО04-02-2006 05:27 PM
SolutionQ. How do I control the PS1 prompt in a PB delegated shell?
A. You can control any environment variable from within a policy, i.e.
setenv("PS1", host +"($PWD) # ");
Hope this helps...
--donovan