calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus,

I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script.

i m looking for something like this

call 3.1;
If 3.1 = "complete" then
call 3.2;
if 3.2 = ''COMPlete" then
call 3.3;
else
exit

The status can obtained from Oracle table called "STATUS_TBL", field names STATUS_RUN And Script_name. It can be either "COMPLETE" or "RUNNING"or "FAILED".

So i want refer each time to status_tbl to see what status it is. If 3.1 is failed then i want to exit, if complete then kick off 3.2, if 3.2 is failed exit, else if 3.2 is complete then kick off 3.3.

So how do i accomplish this in one shell script???? Any example of the code would be great or either code template would be great....

Thank you so much!!!

In shell it would be something like

3.1
STATUS=$(FunctionToGetValueFromOracleTable STATUS_TBL STATUS_RUN 3.1)
[ $STATUS = "complete" ] || exit 1 # exit with error
3.2
STATUS=$(FunctionToGetValueFromOracleTable STATUS_TBL STATUS_RUN 3.2)
[ $STATUS = "complete" ] || exit 1 # exit with error
... and so on

maybe better in a loop like

for PROG in 3.1 3.2 3.3
do
     $PROG
     STATUS=$(FunctionToGetValueFromOracleTable STATUS_TBL STATUS_RUN $PROG)
     [ $STATUS = "complete" ] || exit 1 # exit with error
done

It's a kind of template
Notes :

  1. The script waits the called process to finish, therefore it's not necessary to check "running"
  2. the construction with || replaces the if not [condition] then .. fi
  3. Maybe you need to replace the [ ] with [[ ]]