hallo,
I' m trying to create a shell script that search for some files named
'answer', and for each file founded, the shell script have to email it as an
attachment using the 'mutt' program.
My script is
############### the script ####################
#!/bin/bash
lancer="/usr/bin/mutt -x"
for i in $(ls -p)
do
case $i in
*/) cd $i; pth=$PWD;
for sname in $(ls)
do
case $sname in
answer*) ii=`basename $i`;
comm=$lancer" -s THE_RESULT -a
"$sname" "$ii" < a_text_file";
echo $comm;
result=`$comm`;
esac
done
cd ..;;
esac
done
########## The result of the shell script ###########
echo $comm:
---> /usr/bin/mutt -x -s THE_RESULT -a answer1 sos_linux@hotmail.com <
a_text_file
( for this example, the file answer1 exists in
/home/account/sos_linux@hotmail.com
so here $ii is sos_linux@hotmail.com )
result=`$comm`:
---> deadlock, this command can not be completed,(in the case of ... "$ii"
< a_text_file")
---> show the message "No recipients specified." in the case of ...
"$ii"