LAST_LOG is the file where i'm doing grep for errors
in the function i am retriving the name of the last log created and assign it to LAST_LOG:
LAST_LOG=`ls -tr hbuild.log* | tail -1`
after this i call the grep statment
$grepErr
When i delcare grepErr if i use just $LAST_LOG without ', after echo LAST_LOG is replace with "" so in the function the grep statment will fail because it will not know where to search.
the code is somthing like this
#!/bin/ksh
checkLog()
{
...
LAST_LOG=`ls -tr hbuild.log* | tail -1`
if [ $LAST_LOG = ""]
then
echo hbuild file is not present
exit 1
fi
$1
....
}
grepErr=`echo "grep -i -e ' error ' -e ' errors ' -e 'rror(s)' -e 'Unsatisfied ' -e 'Undefined symbol' -e 'No rule ' -e 'Cannot' -e 'rror:' -e 'Could not find ' -e 'No such file or directory' -e 'Unexpected end of file' -e ' Stop.' -e 'unexpected symbol' -e 'is not a member of'" '$LAST_LOG' "| grep -v 'Warning' > /dev/null"`
....
BUILD_RESULT=`checkLog "$grepErr"`
....
Hope it was more clear this time