System Administration
Showing results for 
Search instead for 
Did you mean: 

HPUX 11i environment variables

Scott McDade
Frequent Advisor

HPUX 11i environment variables

Hello all:

I am trying to set a permanent environment variable for all users. I have tried using export but once I close the dt term the variable goes away. I am using K shell.

Is there a profile or file I need to modify?
Keep it Simple!~
James R. Ferguson
Acclaimed Contributor

Re: HPUX 11i environment variables

Hi Scott:

Since you are using the Korn shell and want _all_ users to have common environmental variables, you can export them from '/etc/profile'. Then, to source (read) this, modify your '.dtprofile' to include the line:



Steven E. Protter
Exalted Contributor

Re: HPUX 11i environment variables


Some in .kshrc

Some in /etc/profile

Customization in .profile

Customization is sometimes needed. For example if all users do not use oracle, then all users do not need ORACLE_HOME set.

Steven E Protter
Owner of ISN Corporation
Scott McDade
Frequent Advisor

Re: HPUX 11i environment variables

Hey guys thanks!

I tried adding the variable to /etc/profile and now I am getting this error.

Warning! One or more of your selected locales are not available.
Please invoke the commands "locale" and "locale -a" to verify your
selections and the available locales.

Continuing processing using the "C" locale.

(specs@ACT01)[/home/specs] 367:

Even after I remove the variable from the /etc/profile.

Keep it Simple!~
Bill Hassell
Honored Contributor

Re: HPUX 11i environment variables

Normally, you simply add the variables to /etc/profile as in:

export VAR1=abcd
export VAR2=xyz123

However, since you mentioned dterm, now you are using a very different environment, namely Xwindows. Your PC is running an Xwindows emulator and you are borrowing a copy of dterm from the server. dterm (and xterm and hpterm by default do not login so the dterm session doesn't run /etc/profile and then $HOME/.profile.

Unfortunately, the DTSOURCEPROFILE only run /etc/profile and skips .profile -- all because the dterm/xterm/hpterm programs do not run as login shells. To make xterm (and hpterm and dtterm) behave like a normal login, you must tell the terminal emulator to run a login shell. Do this by creating .Xdefaults in your $HOME directory (where the xterm is running) with this command:

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

Then close the xterm window and start it again. Now the program will login normally. This file can also set dozens of color and appearance options:

echo "*foreground: white" >> $HOME/.Xdefaults
echo "*background: navy" >> $HOME/.Xdefaults

See man xterm and man xrdb for more information about configuring xterm resources.

Now you can add the variables you need into /etc/profile and they will take effect for users. Note that is you have a special file with application or database variables, these must be 'sourced', that is run with the dot command as in:

. sybase.ksh

The dot is mandatory so that the variables 'stick' with the current login shell.

Bill Hassell, sysadmin