What is wrong with this script

Good day all
I have a UNIX script that I created to set a couple of environment variables for my Oracle installation.

When I initially run the script, I get the correct values on the inbuilt echo command but when the script completes and I issue an echo statement

echo $ORACLE_SID, the system returns the previous SID. Am i missing something here. I am very new to Linux so please let me know if I need to clarify any details

 
clear
echo "Updating environment variables"
ORACLE_SID=ORCLNEW
export ORACLE_SID
echo "ORACLE SID IS" $ORACLE_SID
ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_BASE
echo "ORACLE BASE IS" $ORACLE_BASE
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_HOME
echo "ORACLE HOME IS" $ORACLE_HOME
PATH=/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin
export PATH
echo "PATH IS" $PATH
LD_LIBRARY_PATH=/home/oracle/app/oracle/product/11.2.0/dbhome_2/lib
export LD_LIBRARY_PATH
echo "LIBRARY PATH IS" $LD_LIBRARY_PATH
echo "Completed"

Gotchas

Yazu
How does this interpret in English - I am very new to UNIX

---------- Post updated at 09:42 AM ---------- Previous update was at 09:23 AM ----------

So are you confirming I am unable to update variables using a shell script? Otherwise this means I have to update everyone of these variables eveytime I restart my Unix box.

You just need to add your settings in your ~/.profile file.

I plead for patience on this. In an attempt to run with your suggestion, I have attempted to update the .profile file which to my understanding should be in the home directory
Please see below

[oracle@localhost ~]$ pwd
/home/oracle
[oracle@localhost ~]$ ls
apex             fix.sql               orapworcl           reset.log           StartHere2010.htm
apexlistener.sh  jdeveloper            orapworclone        reset_OE.sql        start_timesten
app              listener              otn_logo_small.gif  reset_sqldev        startup
dav              oracle                otn_new.css         reset_xdbPorts.sql  status
Desktop          oracle_db11g_clr.gif  repos               reset_xmldb         stop_timesten
emshutdown       oraclonepwd           reset_apex          shrink.sh           svn_repo
emstartup        oradiag_oracle        reset_imdbcache     shutdown            tmp
[oracle@localhost ~]$ cd /home
[oracle@localhost home]$ ls
davfs2  lost+found  oracle

I am not seeing the .profile file in the user - oracle folder. I must add that I am using a Linux Virtual PC.

Any ideas?

 
cd 
ls -la

If you want it to be available in the current shell, you should source it like this . ./myscript . It is better to put it in .profile if it is required by apps/scripts.

--ahamed

Thanks for the update and very quick response from you guys

Ill test out the solution in the profile list and update accordingly

Ok
so far I have done the following

 
cd
gedit .bash_profile

added the following

 
export ORACLE_SID=testdb
export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export PATH=/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin
export LD_LIBRARY_PATH=/home/oracle/app/oracle/product/11.2.0/dbhome_2/lib

logged off, logged back in, ran

 
env

and guess what..still old values showing

ran

 
echo $ORACLE_SID

old value

Am i totally missing this or just need unix classes?

can you check the shell of the user?

grep user /etc/passwd

--ahamed