Operating System - HP-UX
1834149 Members
2256 Online
110064 Solutions
New Discussion

Re: PS1 variable being set for

 
Keith Winger
Occasional Advisor

PS1 variable being set for

I am running hp-ux 11.i with BASH 2.05.

I have added the line:
export PS1="\u@\h:\w\\n \#\\$ "
in /etc/profile. This file has been linked to /etc/dt/config/Xsession.d/profile so that it will be read by xwindow logons as well.

The problem is that the PS1 varable is not working when loging in to xwindows. Other variables in profile are exported fine.

I have searched for other locations that may be ovewriting this PS1 variable and have found none.

Any suggestions on this would be appreciated.

Thanks in advance,

Keith

3 REPLIES 3
Geoff Wild
Honored Contributor

Re: PS1 variable being set for

Check:

DTSOURCEPROFILE=true

in .dtprofile

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Keith Winger
Occasional Advisor

Re: PS1 variable being set for

Geoff
Thanks for the response

DTSOURCEPROFILE is currently set to true in .dtprofile.

I have tried to rem this line out and it has not made any difference to the PS1 variable. When I rem it out, other variables, including the DISPLAY variable does not get set correctly. Therefore I currently have DTSOURCEPROFILE=true.

Keith
Bill Hassell
Honored Contributor

Re: PS1 variable being set for

It is VERY common for workstation users or users that run CDE and terminal emulators to access HP-UX to not login 'normally'. This is because the default for CDE (and the obsolete VUE product) is for dtterm, xterm and hpterm NOT to run /etc/profile or .profile during login. (similarly for csh user, the /etc/csh.login file and .cshrc) The reasons behind the Xwindow behavior are obscure but nevertheless quite frustrating.

However, there is an easy fix: In each $HOME directory (the home directory for each user login), perform this task once:

echo "*loginShell: true" >> $HOME/.Xdefaults

Now when the user starts a remote terminal window such as hpterm or dtterm or xterm, the 'normal' Unix login process will be followed and both /etc/profile (the usual place to put ORACLE_HOME and other environmental settings) and $HOME/.profile will be executed.

Note that the CDE variable DTSOURCEPROFILE only affects .profile so it misses the important /etc/profile file. And you can also add the loginShell directive to the startup of dtterm, hpterm or xterm (the option is -ls).

Now if you do not use Xwindows, then verify that your users have a standard shell (/usr/bin/sh or /usr/bin/ksh). Shells like csh, bash, tcsh, etc, should ALWAYS be avoided (better yet: forbidden) on production servers as they create sysadmin nightmares for support. And to see if /etc/profile and the local .profile are really being executed, put a print or an echo at the front of both files so you know they are being run:

echo "...Now running /etc/profile..."

or

echo "...Now running $HOME/.profile..."

If this works OK but the values are still not set, use the shell script trace option as in:

sh -x /etc/profile

or

sh -x $HOME/.profile

For users with a problem.


Bill Hassell, sysadmin