In all my Googling, this usually happens when someone is comparing a variable, and that variable is unset. That doesn't appear to be the case for me...
Code:
#!/bin/bash -x
while read line
do
f=$(echo $line | tr -s ' ' | cut -d' ' -f 3)
echo $f
if [ "$f" >= 500 ]
then
echo "This is a finding"
echo $i
fi
done < /tmp/ls.txt
Result:
Code:
+ read line
++ echo drwxr-xr-x@ 39 0 0 1326 Oct 1 14:01 .
++ tr -s ' '
++ cut '-d ' -f 3
+ f=0
+ echo 0
0
+ '[' 0 500 ']'
./test.sh: line 15: [: 0: unary operator expected
It seems to be tossing my ">=" away.