I'm trying to make this bash script dispatch and email when it detects that a certain type of file (files ending in .gz), which was last modified 24 hours ago, is below a certain size in a directory, I currently have it running on my entire computer. (I have it set to 10 kilobytes).It just sends an email regardless, I expect it only to send one if it actually detects that the file is under the threshold, and if someone could please go through it and try to tell me where I messed it up that would be great! This is one of my first serious scripts so go easy on the vocabulary!1) The script will find all of the files in a directory ending with .gz that were modified in the last 24 hours.2) It will check these files and make sure they are above a certain threshold in size (say 10 kilobytes for example)3) If they are it will do nothing, but if they are under that threshold, an email will be dispatched to the said email address #!/bin/bashfor file in /*; dostat $file    FAILURE= find . -name *.gz -size -10k -mtime -1 -printf 'Failure %p\n'doneif $FAILUREthen    echo The backup test has failed! | mail -s BACKUP FAILURE myemail@gmail.comfi
Bash script that detects if a file is the correct size
linux;bash;shell;scripting;email