On Thursday 06 March 2008 12:59:07 James D. Parra wrote: [...]
Thank you, this helps. Using the -a switch I noticed 'mail' only sends one attachment even if using a wild card. That's because _each_ file to be attached must have the -a switch. A wildcard on the command line is expanded by the shell into a list of the matching filenames. The shell doesn't know you wanted '-a' in front of each one.
For example, mail -s Test -a LN*.log me@example.com, will only send the fist file with LN and not the rest.
LN080303.log <--- 'mail' will attach this and no others. LN080304.log LN080305.log LN080306.log
How can 'mail' send more than one file?
mail -s "Test" $(ls LN*.log | sed -e 's/^/-a /') me@example.com <<MSGEND Log files as of $(date) MSGEND will generate an email with all the matching log files preceded by '-a' in the command line, and a one line message body listing the date/time of the message. As I said in an earlier reply, this is one of perhaps several ways to do it. An additional thought: Log files are (usually) all text that is very compressible. You might want to consider compressing each log file first. Or, you could create a single compressed tar file containing the uncompressed log files--you get two benefits: compression and just one file to attach. -- Jim