2

I am sending multiple files using following line in my script

find . -type f -name "Sum*pdf*"|while read name; do uuencode "$name" "${name##*/}"; done | mailx -s "North Bus Correction" $RECIP

Now I want to have body of mail as well with the attachments and I have tried the below one

(echo "Bus Correction";find . -type f -name "Sum*pdf*"|while read name; do uuencode "$name" "${name##*/}"; done) | mailx -s "North Bus Correction" $RECIP

But I am getting only attachments not with body of mail. What is wrong in that please help me on this. I am using AIX.

1

You are also better off using find's built-in executing facilities, no need for a while loop

(echo "Bus Correction" && find . -type f -name "Sum*pdf*" -exec \
  bash -c 'for f; do uuencode "$f" "${f##*/}"; done' _ {} + ) | 
 mailx -s "North Bus Correction" $RECIP
0

Wow.... My trails were worked

(echo "Bus Correction" && find . -type f -name "Sum*pdf*"|while read name; do uuencode "$name" "${name##*/}"; done)| mailx -s "North Bus Correction" $RECIP
  • maybe you can give us some explanation ? – Archemar Feb 6 '15 at 14:13
  • @Archemar Usually && is used for merge two commands in the script, when i tried that it works, now i am getting mail with body and multiple attachments. – Aravind Feb 6 '15 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.