Hi, Im trying to write a ksh script that when run changes the enviroment
variables for that session. What i mean i want to run the script and then
until i logout and log back in I want to use the new settings. Here is the
script thats not working:
#!/bin/ksh
JHOME="/usr/java$1"
echo "Changing JAVA_HOME to $JHOME"
export JAVA_HOME=$JHOME
echo "Adding $JHOME/bin to PATH"
export PATH=$JHOME/bin:$PATH
echo "New JAVA_HOME $JAVA_HOME"
echo "New PATH $PATH"
This is what happens when i run it
$ ./change_java 1.1
Changing JAVA_HOME to /usr/java1.1
Adding /usr/java1.1/bin to PATH
New JAVA_HOME /usr/java1.1
New PATH
/usr/java1.1/bin:/usr/java1.3/bin:/usr/bin::/opt/oracle/product/817/bin
$ echo $JAVA_HOME
/usr/java1.3
As you can see the value of JAVA_HOME reverts back after the script is
executed...how do i avoid this?
THanks!