Hi!
I'm trying to setup a shell script to startup a number of programs when I run it, but I've got some issues with variables that is causing it not to work...
The bunch of lines at fault is this:
if /I "%INST%" == "OID" (
set NAME=9iAS_INF
set HOME=D:\oracle\%NAME%
rem set PATH=%HOME%\bin;%HOME%\dcm\bin;%HOME%\opmn\bin;%PATH%
set ORACLE_HOME=%HOME%
goto END
set ORACLE_SID=iasdb
GOTO OID
)
Now... %INST% has been previously set as %1, and that seems to work fine. However, sometimes the HOME and ORACLE_HOME variables don't work! (I've got the 'goto END' in there so the script doesn't actually execute.) I've added setlocal to the start of the script and endlocal to the end, as well.
Here's the output (I set echo to on):
C:\Documents and Settings\jhiggs>if /I "oid" == "OID" (
set NAME=9iAS_INF
set HOME=D:\oracle\
rem set PATH=\bin;\dcm\bin;\opmn\bin;D:\oracle\OWB_S\bin;D:\oracle\OWB_DT\bin;D
:\oracle\9iAS_INF\bin;C:\oracle\9iDS\jdk\jre\bin\classic;C:\oracle\9iDS\jdk\jre\
bin;C:\oracle\9iDS\bin;C:\oracle\9iDS\jlib;D:\oracle\9iAS_BI\jdk\jre\bin\classic
;D:\oracle\9iAS_BI\jdk\jre\bin;D:\oracle\9iAS_BI\bin;D:\oracle\9iAS_BI\jlib;D:\o
racle\9iAS_INF\jlib;D:\oracle\9iDB\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\
Program Files\Oracle\jre\1.1.8\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\
Wbem;C:\Program Files\Symantec\pcAnywhere\;D:\script\;D:\oracle\9iAS_INF\bin\;D:
\oracle\9iAS_BI\bin\
set ORACLE_HOME=
goto END
set ORACLE_SID=iasdb
GOTO OID
)
C:\Documents and Settings\jhiggs>endlocal
So in this case, NAME is correct, but HOME has not been set for some reason, as it's D:\oracle ... as a result, ORACLE_HOME is not set either, which causes the program to not start correctly later in the script!
Can anyone help? I'm new to shell scripting in Windows (I've done BASH shell scripting, but not Windows) I think it's got something to do with the NAME and HOME variables, but I'm not sure what...
Thanks a lot!