Sugiro substituir seu bloco if
por:
/opt/ImageMagick/bin/identify -verbose "$f" | /usr/bin/grep -iq "Corrupt"
if [[ ${PIPESTATUS[0]} -eq 0 && ${PIPESTATUS[1]} -eq 1 ]]; then
mv "$f" "$INPUT_FOLDER"
else
mv "$f" "$CORRUPT_FOLDER"
fi
De man bash
:
PIPESTATUS
: An array variable (see Arrays below) containing a list of exit status values from the processes in the most-recently-executed foreground pipeline (which may contain only a single command).