The codes are below, I want to check some files whose file size is less than 410Bytes:
for file in *; do
if [[ "$file" =~ ^dataset([0-9]+)$ && `du -b $file/${BASH_REMATCH[1]}_conserv.png` -lt 410 ]]; then
cd $file
$some_commands
cd ..
fi
done
However, when I run this script, it complains like this:
less_than_410.bash: line 2: [[: 13605 dataset4866/4866_conserv.png: syntax error in expression (error token is "dataset4866/4866_conserv.png")
Does anyone have ideas about how to fix this? Thanks!