[Suse 8.0] Send a file attachment Using mutt in a shell script..
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" <a_text_file" (without space between '<' and 'a_text_file') ####################################### So what's the cure of this problem ? Thanks. _________________________________________________________________ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=htt... Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.
robert guru wrote:
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" <a_text_file" (without space between '<' and 'a_text_file')
#######################################
So what's the cure of this problem ?
Thanks.
_________________________________________________________________ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=htt... Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.
I think the find command would work better, & wouldn't require a separate script. man find .... -- William A. Mahaffey III --------------------------------------------------------------------- Remember, ignorance is bliss, but willful ignorance is LIBERALISM !!!!
participants (2)
-
robert guru
-
William A. Mahaffey III