Computing.Net > Forums > Unix > Unable to set PS1 prompt - AIX - su

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Unable to set PS1 prompt - AIX - su

Reply to Message Icon

Name: Rashmi Vinay
Date: June 20, 2007 at 01:31:01 Pacific
OS: AIX
CPU/Ram: 512MB
Product: AIX 5.2, 5.3
Comment:

Hi all,

I was unable to set PS1 environment variable (prompt) to a customised one when I logged into an AIX box with normal user credentials and then switched over to the root user credentials via a perl script
which uses Net::Telnet (CPAN) module. Sourcing the script and changing the .profile file solutions provided on the net was not helpful as I was not allowed to do any modifications with respect to settings on the box. So, I found a way where I could accomplish this.


My Solution: While switching over to other user (say root) which is accomplished through su command, we can send required flags and as well the command to be exceuted. So, I could do it in the following manner:

su - root -ip -a -c env;PS1='customized
one';PS1;

where:
-ip: interactive and privileged
-a: export all the subsequent parameters (here it is PS1)
-c: run the command specified as a string following it


Hope this solution could help any one who would encounter similar kind of a problem in the near future.


Regards,
Rashmi Vinay

Determination Dedication & Hard Work -key points to success



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Unable to set PS1 prompt - AIX - su

SCO set prompt to working directory www.computing.net/answers/unix/sco-set-prompt-to-working-directory/3010.html

Script: Read file to set variables www.computing.net/answers/unix/script-read-file-to-set-variables/3849.html

how to set my prompt to display current directory www.computing.net/answers/unix/how-to-set-my-prompt-to-display-current-directory/1106.html