My script below seems to be choking because I need the the output of the find command to be stored as a variable that can then be called by used lower in the script.
#!/bin/bash
cd "/resumes_to_be_completed"
var1=find . -mmin -1 -type f \( -name "*.doc" -o -name "*.docx" \)
snd="notification@domain.com"
recp="myemail@domain.com"
while inotifywait -e create /resumes_to_be_completed;
do sleep 10;
sudo chmod -R 777 /resumes_to_be_completed/;
cat $var1 | uuencode $var1 | sendmail -F "New Resumes" -f $snd $recp ; done
I run the script and it appears fine until it is triggered.
user@resumes:/scripts# ./new_resumes.sh
Setting up watches.
Watches established.
/resumes_to_be_completed/ CREATE foo.doc
uuencode: invalid option -- 'i'
Try `uuencode --help' for more information.
cat: invalid option -- 'm'
Try `cat --help' for more information.
As you can see its erroring out at the uuencodeportion and that appears to be because the output of the find command isnt being stored.