However, I do not want dbquery2.sh to be executed unless dbquery1.sh executes successfully[If there is any ORA Database error then also dbquery2.sh should not execute].
Hi, question is that sqlplus return an errorcode only if there are a connection issue, else in every case return 0.
A simple solution is to redirect the output to a tmp file and check the content:
echo "Calling dbquery1.sh...."
./dbquery1.sh > output.tmp
grep -q ORA- output.tmp
if [ $? -ne 0 ]
then
echo "Calling dbquery2.sh...."
./dbquery2.sh
fi