Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set JAVA_HOME for root

Status
Not open for further replies.

aswolff

Programmer
Jul 31, 2006
100
US
I am on a solaris 9 machine.

I created a simple script to set environment variables:

Code:
#!/bin/ksh
export PATH=/usr/local/java/jdk1.5.0_03/bin:$PATH
export JAVA_HOME=/usr/local/java/jdk1.5.0_03

When I run the script and echo the above two env variables It's still set to the original values. If I manually type in the above 2 commands then it works. So why is my script not doing the same thing? (I get a feeling it something about subshells and root..that I just do not understand)

Thanks.
 
In your shell man page have a look at the . (dot) or source command.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Ahhhh...

. ./setMyEnv.ksh

Thanks for the hint.
 
You may also consider the ENV environment variable.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top