I have to write a script in ksh which again should call another script. Say A.ksh is calling B.ksh. Now in B.ksh if the condition we are checking for is true then we have to go back to the main script A.ksh or if the condition in B.ksh is false then we have to totally come out of the scripts.
I have written a sample code and trying to achive the functionality mentioned above. In case of successs i was able to come back to the main script but even in case of failure it is coming back to main script A.ksh which is not wanted. Below are the sample scripts i am working on.
A.ksh
while [ 1 ]
do
for file in `ls /home/inputfile/*.dat`
do
tc=/home/oracle/db.log
string=`sqlplus user/pass <<EOF >$tc
set serveroutput on;
select 'DATABASE IS UP' from dual;
exit;
EOF`
if grep 'DATABASE IS UP' $tc; then
cd /home/oracle/test/
./echoing.ksh
else
echo "db is down"
fi
done
sleep 5
done
B.ksh
echo "db is up so came into new script"
if grep 'error files' /home/oracle/db.log; then
echo "file has the word wanted to check for"
echo "now the script should go back to main script"
sleep 5
cd /home/oracle/test/
./ods.ksh
else
echo "error hence coming out"
fi