I have a log file that I want to archive out as it reaches 100MB. I am using the following to get the file size into a variable but get the error "line 5: [: -gr: binary operator expected"
This is still the test code to work out the comparison.
filesize=$(wc -c < logfile.log)
if [ $filesize -gr 100000000 ]
then
echo "is greater than 100M"
else
echo "is less than 100M"
fi
I'm sure there's something I'm being braindead on and overlooking. I'm pretty adept at batch files, but this is my initial foray into bash.
Thanks.