The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to attach a file & send mail thru script Mar1006 Shell Programming and Scripting 9 10-12-2006 05:54 AM
How to attach a file in a email ting123 UNIX for Dummies Questions & Answers 2 05-11-2006 03:14 PM
Need to attach a txt file while sending mail charan81 Shell Programming and Scripting 9 01-11-2006 09:44 PM
How to attach an excel file/ dat file thru unix mails diwakar82 Shell Programming and Scripting 1 01-06-2006 07:23 AM
How to attach a file in mail? firebirdonfire UNIX for Dummies Questions & Answers 1 03-29-2001 04:38 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-16-2007
Registered User
 

Join Date: Oct 2007
Posts: 5
hi.. how to attach a tar file using shell script

Hi,


How to attach a tar file using shell script or the command liine..

I following command just send the mail to the person with .txt file as body, I want to send it as attachment.

/usr/sbin/sendmail -f "user1@daemon.com" user2@daemon.com <hi.txt

The contents of the hi.txt will be sent as the body of the message..


Please help..... Thanks in advance..


Madhu
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-17-2007
Moderator
 

Join Date: Dec 2003
Location: /ksh93
Posts: 863
There is no simple oneliner for doing this. The classic UNIX way would be to uuencode the tarball and embed it as part of your message. There are however a number of ways of building a message with an attachment.

The following should work if your version of uuencode supports the -m option (but I have no tested it!)

(cat hi.txt ; uuencode -m file.tar tarball) | sendmail -f "user1@daemon.com"

Here are a couple of pointers:

Mailing Attachments from UNIX
Sending email with a text message and an attachment from standard UNIX.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0