Operating System - HP-UX
1832860 Members
2938 Online
110048 Solutions
New Discussion

Which file contains environment variables?

 
SOLVED
Go to solution
susee_sundar
Regular Advisor

Which file contains environment variables?

Hi,

In my server., I want to modify the environment variables..
______________________

bash-2.05$ env
PWD=/
TZ=Asia/Calcutta
LC_MESSAGES=C
HZ=100
HOSTNAME=nibappsun08
LD_LIBRARY_PATH=/usr/local/lib
LC_TIME=en_US.ISO8859-1
MACHTYPE=sparc-sun-solaris2.9
MAIL=/var/mail/fastuser
OLDPWD=/etc
EDITOR=vi
JAVA_HOME=/usr/jdk/jdk1.5.0_08
LC_NUMERIC=en_US.ISO8859-1
LOGNAME=fastuser
SHLVL=2
LC_CTYPE=en_US.ISO8859-1
SHELL=/bin/sh
HOSTTYPE=sparc
OSTYPE=solaris2.9
HOME=/usr/local/fastuser
TERM=xterm
PATH=/usr/bin::/usr/jdk/jdk1.5.0_08/bin
LC_MONETARY=en_US.ISO8859-1
LC_COLLATE=en_US.ISO8859-1
_=/usr/bin/env
bash-2.05$
_____________

Which file I need to modify for the changes to take effect after a restart..

For a specific user I can put in .profile file in the home directory.

But I need to modify it universally, hence all the users will get impact with the settings.


Thanks & Regards
Suseendran .A
7 REPLIES 7
Ivan Krastev
Honored Contributor
Solution

Re: Which file contains environment variables?

For bash:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

So you can add your modifications in /etc/profile and this will affect all users.


regards,
ivan
Peter Godron
Honored Contributor

Re: Which file contains environment variables?

Hi,
/etc/profile

Dennis Handly
Acclaimed Contributor

Re: Which file contains environment variables?

>In my server, I want to modify the environment variables..

Note you don't want to modify all of these, some are user specific.

The most important one is OSTYPE, you should set it to HP-UX. ;-)
susee_sundar
Regular Advisor

Re: Which file contains environment variables?

Hi.,

But i found only the few tings there in /etc/profile.
__________________________

bash-2.05$ cat profile
#ident "@(#)profile 1.19 01/03/13 SMI" /* SVr4.0 1.3 */

# The profile that all logins get before using their own .profile.

trap "" 2 3
export LOGNAME PATH

if [ "$TERM" = "" ]
then
if /bin/i386
then
TERM=sun-color
else
TERM=sun
fi
export TERM
fi

# Login and -su shells get /etc/profile services.
# -rsh is given its environment in its .profile.

case "$0" in
-sh | -ksh | -jsh | -bash)

if [ ! -f .hushlogin ]
then
/usr/sbin/quota
# Allow the user to break the Message-Of-The-Day only.
trap "trap '' 2" 2
/bin/cat -s /etc/motd
trap "" 2

/bin/mail -E
case $? in
0)
echo "You have new mail."
;;
2)
echo "You have mail."
;;
esac
fi
esac

umask 000
trap 2 3

JAVA_HOME=/usr/jdk/jdk1.5.0_08
export JAVA_HOME

PATH=$PATH:$JAVA_HOME/bin
export PATH

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
bash-2.05$
______________________________

But how can I set the timezone., since i dont found any entry for timezone in /etc/profile

TZ=Asia/Calcutta

Time Zone Variable

Regards
Suseendran .A

Dennis Handly
Acclaimed Contributor

Re: Which file contains environment variables?

>But I found only the few things there in /etc/profile.

That's the way it should be, few as possible.
The others are set based on the user's .profile in their home directory.

>But how can I set the timezone, since I dont found any entry for timezone in /etc/profile
TZ=Asia/Calcutta

The same as the others:
TZ="Asia/Calcutta"; export TZ
susee_sundar
Regular Advisor

Re: Which file contains environment variables?

Thanks to all...

I declared the variables inside the /etc/profile file and it is replicating to all the users..

Regards
Suseendran .A
susee_sundar
Regular Advisor

Re: Which file contains environment variables?

Thanks to all