Getting the error above when running my script. Trying to check if the value of output is not = to "average:". If not, then print to list file, if it is then start from beginning of loop.
#!/bin/bash
Oad=$(date +%Y_%m_%d.%H.%M.%S)
for i in {1..120}
do
OUTP= uptime | awk '{print $10}' | cut -f1 -d,
echo $OUTP
if $OUTP != average:
then $OUTP >> $Oad.lst
else continue;
fi
sleep 60
done
cat $Oad.lst | awk '{if(min==""){min=max=$1}; if($1>max) {max=$1}; if($1<min) {min=$1}; total+=$1; count+=1} END {print total/count, max, min}' > $Oad.out
That's not the way to compare it.
Should be
Some line seemed odd as well
I think should be
And
if you want to send the value of the variable to the file, it should be
Overall I would suggest a format like this:
One more note. For:
You probably mean it as:
To match any line not containing
average:
instead of any line that's not exactly like it.