Email Attachments in shell script

Hi Fellas,

I have a script that queries a sybase DB through isql and appends to a file, say file.csv

I want to use the mail command in the shell script to email the file to me. i tried the following command but it doesn't work. can any one suggest whats wrong here. Note that i need the file as an attachment and not as body of the email.

mailx -s "generated file" -a /home/bin/file.csv myself@email.com 

When i run this on the command prompt and hit Ctrl+D it works but it doesn't in a shell script. Please advise

search the forum
Google Search Results for mailx attachment | The UNIX and Linux Forums

Try this one

$uuencode /home/bin/file.csv file.csv | mail -s "Generated file" myself@gmail.com