Code:
ERROR_MSG=`cat $LOGFILE.$strFileName`
ERROR_CDE=`egrep '(ORA-04068|ORA-04061|ORA-06512)' $ERROR_MSG | sed 's/:.*//'`
The first command is putting the contents of the file into the variable ERROR_MSG - let's say it contains the file contains the text "I love cheese". So now the variable contains this string.
Next you're running the egrep command using the contents of this variable. So the command it's trying to run will look like this:
Code:
egrep '(ORA-04068|ORA-04061|ORA-06512)' I love cheese
The shell will think you're trying to open 3 files - one called I, another called love and yet another called cheese. Would something like the following work?
Code:
ERROR_CDE=`egrep '(ORA-04068|ORA-04061|ORA-06512)' $LOGFILE.$strFileName | sed 's/:.*//'`
if (( "$ERROR_CDE" > "" )) then
break
fi
It would be well worth printing each variable out when you set it just to make sure everything is doing exactly what you are expecting. It might also be worth investing in a small book on shell programming
