ls -lR $dir > als -lR $dir > bDIFF=$(diff a b) if [ "$DIFF" != "" ] then echo "The directory was modified"fi
if ! diff -q a b &>/dev/null; then >&2 echo "different"fi
You are looking for the return value of diff and not the output of diff that you are using in your example code.
diff
Try this:
diff a bif [ $? -ne 0 ]; then echo "The directory was modified";fi