- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Keeping PS1 same
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
Forums
Discussions
Discussions
Discussions
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
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-02-2009 11:26 AM
03-02-2009 11:26 AM
I am using PS1 environment variable in .profile to see servername and my home directories etc.
export PS1="$(uname -n)@$(whoami)\$PWD>"
But when i execute PowerBroker command to su to different user then this PS1 setting gets lost.
Is there a way to retain it even if i change to different user ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2009 11:37 AM
03-02-2009 11:37 AM
Solution> But when i execute PowerBroker command to su to different user then this PS1 setting gets lost. Is there a way to retain it even if i change to different user ?
If you 'su - username' then you are sourcing the user's profile. This is going to reset or set its own PS1 environmental variable.
If you 'su username' _without_ the dash (hyphen) then 'su' does _not_ source the target user's profile, leaving your current environment unchanged.
See the 'su' manpages for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2009 11:49 AM
03-02-2009 11:49 AM
Re: Keeping PS1 same
'su-username' is mandatory. I just tried and it is not taking without "-".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2009 11:55 AM
03-02-2009 11:55 AM
Re: Keeping PS1 same
'su - username' is mandatory. I just tried and it is not taking without "-".
If this is the case, then your PS1 value will be reset to whatever value the .profile and other login scripts for 'username' use for PS1. You cannot use the "-" for a login shell while *not* having the login scripts executed. The use of "-" on su will force PS1 to be changed if the other user's login scripts change it, period.
HP-Server-Literate since 1979
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2009 11:57 AM
03-02-2009 11:57 AM
Re: Keeping PS1 same
> In our PowerBroker setup looks like
'su-username' is mandatory. I just tried and it is not taking without "-".
You need to find out what environmental variables are needed in the target environment; place them in a stand-alone file; and source (read) them once you have switched users.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2009 08:01 PM
03-02-2009 08:01 PM
Re: Keeping PS1 same
Or the reverse, find out what sets PS1 and source that after you use PowerBroker.
For me, my PS1 is always "$ ". I have a pushd/popd functions that puts the directory path in the window title.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2009 09:12 PM
03-02-2009 09:12 PM
Re: Keeping PS1 same
This above setting will be set for all the users.
First /etc/profile executes and then .profile of user. Hence whatever defined in .profile will override variables defined in /etc/profile