RE: [opensuse] using 'mail' from command line.
Using 'mail' in the command line and I can't find how to make it non-interactive. I want to just send the mail without it needing me to use a '.' (dot) to send the message. What is the correct syntax to send this on its way? I'd like to insert this into a script.
Use a pipe, with the contents of the email. I have used that in a script. ~~~~~ Thank you, this helps. Using the -a switch I noticed 'mail' only sends one attachment even if using a wild card. 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? Many thanks, ~James -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Thursday 2008-03-06 at 12:59 -0800, James D. Parra wrote:
Use a pipe, with the contents of the email. I have used that in a script.
~~~~~
Thank you, this helps. Using the -a switch I noticed 'mail' only sends one attachment even if using a wild card.
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?
Perhaps listing them explicitly: -a LN080303.log -a LN080304.log -a LN080305.log .... etc. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQFH0IE/tTMYHG2NR9URAusQAJ9BQQW9MZUk+T2zmuM6abnJHz+fpwCghrNj pNSQKQLuCiwvkAq2z+RR9aM= =wqus -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Carlos E. R.
-
James D. Parra
-
Jim Cunning