ERROR CHECKING !!
- by moata_u
am trying catch any error when run command in order to write an log file / report
i was trying write this code :
FUNCTION FOR VALIDATION
function valid (){
if [ $? -eq 0 ]; then
echo "$var1" ": status : OK"
else echo "$var1" ": status : ERROR"
fi
COMMAND FUNCTION
function save(){
sed -i "/:@/c connection.url=jdbc:oracle:thin:@$ip:1521:$dataBase" $search
var1="adding database ip"
valid $var1
sed -i "/connection.username/c connection.username=$name" #$search
retval=$?
var1="addning database SID"
valid $var1 $retval
}
save
OUTPUT
adding database ip : status : OK
sed: no input file
i want out put in this way:
adding database ip : status : OK
sed: no input file : status : ERROR"
(OR)
adding database ip : status : OK
addning database SID : status : ERROR"
I was tried toooo much but not working with me :(((