# Explanation of what works and doesn't when calling mail with various params: #[krice@test1 krice]$ EMDEST="Kevin@justanyone.com" #[krice@test1 krice]$ ps | mail -s 1132 $EMDEST OK #[krice@test1 krice]$ ps | mail -s 1132A "$EMDEST" OK #[krice@test1 krice]$ ps | mail -s "1132B" "$EMDEST" OK #[krice@test1 krice]$ ps | mail -s "1132C" '$EMDEST' BAD #[krice@test1 krice]$ EMDEST="Kevin\@justanyone.COM" #[krice@test1 krice]$ ps | mail -s "1132D" '$EMDEST' BAD #[krice@test1 krice]$ ps | mail -s "1132E" $EMDEST BAD #[krice@test1 krice]$ EMDEST="Kevin@justanyone.COM" #[krice@test1 krice]$ ps | mail -s "1132F" $EMDEST OK
Professional programmer; amateur home handyman (on our home only); tinkerer; husband; father of 3; attempting to be a renaissance guy (to know at least a little about a lot of subjects, a doomed pursuit in an information age); geek-arts-and-sciences enthusiast. Interest areas: Science fiction, wind turbines, electric cars, renewable energy, making things.
Wednesday, April 11, 2012
Calling Mail from command line - What works and doesn't
I had some trouble recently calling /bin/mail with -s for subject, quoting
the actual subject in single or double quotes, and passing in
the destination addresses in a shell / environment variable.
So, here's the truth table of what works and what doesn't.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment