Hello,
I am writing a simple Bash script to detect when a folder has been modified.
It is something very close to:
ls -lR $dir > a
ls -lR $dir > b
DIFF=$(diff a b)
if [ $DIFF -ne 0 ]
then
echo "The directory was modified"
Unfortunately, the if statement prints an error: [: -ne: unary operator expected
I am not sure what is wrong with my script, would anyone please be able to help me?
Thank you very much!
Jary