I have created a script so I can search for 0kb files in a certain path, the output is to be redirected to a text file and then emailed. The script works except that the fie is empty either when it's emailed or when it's viewed after the script runs.
if [[ -n $(find /path/to/files/ -type f -empty -mmin +2) ]] then
> /tmp/output.txt ; mail -s "subject" -a /tmp/output.txt "email@address"
rm /tmp/ftr_output.txt
fi
Not sure if I missed something so any help would be appreciated.
Thanks
/tmp/output.txtbe truncated. Why do you expect content to be in there? What are you trying to achieve?> /tmp/output.txtwas supposed to be inside the$()