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.

2 Answers 2


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

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
    Commented Feb 6, 2015 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
    Commented Feb 6, 2015 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .