ot: mail flag for attachment in unix
Bill Campbell
bill at celestial.com
Wed Sep 30 19:06:08 PDT 2009
On Wed, Sep 30, 2009, Dennis Malen wrote:
> Here's the last conundrum. What I now wanted to do was to send a script
> that attaches a file to the email and also writes a message in the body
> of the email.
>
> I attempted to use:
>
> uuencode /tmp/emccx.xls emcc.xls | mail -s "test3" dmalen at malen.com <tryftp
>
> If I use the right side of the pipe separately it places the contents of
> "tryftp" in the body. If I use the full line without the "<tryfile" it
> attaches "emcc.xls" to the email.
>
> When I try the entire line above, the right side of the pipe wins and
> just places the contents of "tryftp" in the body of the email without any
> attachment.
>
> Am I precluded from combining the two sides in UNIX this script or
> anything like it?
Any process in Unix has three files open by default, Standard
Input, Standard Output, and Standard Error. Either the pipe or
the ``<'' character will go to Standard Input.
You could say something like this where the things in the
parentheses are executed in a separate shell which then would
have its Standard Output the combined result of uuencode and
cat).
(uuencode /tmp/emccx.xls emcc.xls; cat tryftp) | mail -s ...
Bill
--
INTERNET: bill at celestial.com Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
Voice: (206) 236-1676 Mercer Island, WA 98040-0820
Fax: (206) 232-9186 Skype: jwccsllc (206) 855-5792
Each individual of the society has a right to be protected in the
enjoyment of his life, liberty, and property no part of the property
of any individual can, with justice, be taken from him, or applied to
public uses, without his own consent -- John Adams
More information about the Filepro-list
mailing list