HI All
I have a script which counts how many times a job has failed.
For some reason my echo $list wont work in a variable, it works if i dont put it in a variable, but i need this in a variable so i can do a grep -c against another file.
Any help would be appreciated.
#!/usr/bin/ksh
set -x
cat /apps/tech/testruniquefailures | while read list ; do
JOBNAME=`echo $list`
Num=`grep -c $JOBNAME /apps/tech/testfailures1`
if [ $Num -gt 0 ] ; then
print $JOBNAME has failed $Num times >> /apps/tech/jinfo.txt
fi
done
This is the output with debug
+cat /apps/tech/testruniquefailures
+read list
+JOBNAME=echo
++ grep -c /apps/tech/testfailures1
Num=0
+ [ - -gt 0 ]
+read list