#!/bin/sh
echo "Running Script to capture ORACLE Erros"
# Change Directory to the actual logs path
cd /home/nv8510/lognew
err_var=`grep -in "ORA-" *`
if[-n $var] then
echo "THESE ARE THE ORACLE ERROR OCCURED"
echo "$err_var"
echo "************************************************************************"
else
echo "No erros"
fi
In the abv script i want to chk if the variables exits then i will display all the error msg and if not it will display No errors , but i ma getting this error will executing the script :
./nvora2.sh: line 8: if[-n ]: command not found
how to chk if a varible is set or not , please help.
---------- Post updated at 05:03 PM ---------- Previous update was at 05:00 PM ----------
#!/bin/sh
echo "Running Script to capture ORACLE Erros"
# Change Directory to the actual logs path
cd /home/nv8510/lognew
err_var=`grep -in "ORA-" *`
if[ -n "$var"] then
echo "THESE ARE THE ORACLE ERROR OCCURED"
echo "$err_var"
echo "************************************************************************"
else
echo "No erros"
fi
I am trying the ab now and getting this erro :
Running Script to capture ORACLE Erros
./nvora2.sh: line 8: if[ -n ]: command not found
THESE ARE THE ORACLE ERROR OCCURED
************************************************************************
./nvora2.sh: line 14: syntax error near unexpected token `else'
./nvora2.sh: line 14: `else'
so lets go now to nest step , i m getting this error now
Running Script to capture ORACLE Erros
./nvora2.sh: line 14: syntax error near unexpected token `else'
./nvora2.sh: line 14: `else'
******************************
#!/bin/sh
echo "Running Script to capture ORACLE Erros"
# Change Directory to the actual logs path
cd /home/nv8510/lognew
err_var=`grep -in "ORA-" *`
if [ -z "$var" ] then
echo "THESE ARE THE ORACLE ERROR OCCURED"
echo "$err_var"
echo "************************************************************************"
else
echo "No erros"
fi