Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Assuming you have mailx set up properly and working, then the line you gave should work, but both files would end up sending as one, which can confuse uudecode if you don't split them up before decoding.
Usually, if you want to send multiple files via uuencode, it is best to make a tarball first ( tar -cvzf file.tar.gz file1 file2 .. fileN ) then encode and send that. then the recipient can use uudecode then tar -xvzf file.tar.gz to extract them.
so:
tar -cvzf file.tar.gz file1 file2 file3 ; uuencode file.tar.gz file.tar.gz
Assuming you have mailx set up properly and working, then the line you gave should work, but both files would end up sending as one, which can confuse uudecode if you don't split them up before decoding.
Usually, if you want to send multiple files via uuencode, it is best to make a tarball first ( tar -cvzf file.tar.gz file1 file2 .. fileN ) then encode and send that. then the recipient can use uudecode then tar -xvzf file.tar.gz to extract them.
so:
tar -cvzf file.tar.gz file1 file2 file3 ; uuencode file.tar.gz file.tar.gz
I agree, that is the solution I would choose, but:
Will work. I do assume that mail is set up properly and testme.com is a valid e-mail address.
A test shows this:
Code:
$ ( uuencode foobar foobar ; uuencode fubar fubar ) | mailx -s test druuna
$ mail
Mail version 8.1.2 01/15/2001. Type ? for help.
"/var/mail/druuna": 1 message 1 new
>N 1 druuna@plains.wil Thu Aug 29 16:04 23/649 test
&
Message 1:
From druuna@plains.wildfire.nl Thu Aug 29 16:04:55 2013
Envelope-to: druuna@plains.wildfire.nl
Delivery-date: Thu, 29 Aug 2013 16:04:55 +0200
Date: Thu, 29 Aug 2013 16:04:55 +0200
To: druuna@plains.wildfire.nl
Subject: test
From: druuna <druuna@plains.wildfire.nl>
begin 640 foobar
.,0HR"C,*-`HU"C8*-PH`
`
end
begin 640 fubar
080IB"F,*9`IE"F8*9PIH"@``
`
end
&
Last edited by druuna; 08-29-2013 at 09:11 AM.
Reason: Fixed typo.
I don't think there is any wrong in my script. I just ran the same command online on unix console and seems to be working fine but I have no idea why it doesn't work within my shell script
I don't think there is any wrong in my script. I just ran the same command online on unix console and seems to be working fine but I have no idea why it doesn't work within my shell script
If you don't post the script here, we cannot help you.
You mention Unix; On what platform are you trying to do this?
@sysmicuser: The script doesn't generate any output at all when you execute it?
When using set -x there should be output generated, please post this.
On first glance I don't see anything wrong (I'm not a DB man and I assume the sql parts are correct). Only thing that I would call suspicious is the old redhat version (5.3), this should be 5.9 as of 2013.
Script generates output. It generates two csv files but they are not sent as an attachment !! Yep, the sql parts are fine. I have no idea why it is not sent as an attachment.
Yep posting output.
Last edited by sysmicuser; 08-30-2013 at 09:11 AM.
Script generates output. It generates two csv files but they are not sent as an attachment !! Yep, the sql parts are fine. I have no idea why it is not sent as an attachment.
I'm not talking about the files that are generated by the script. I'm talking about the output generated by set -x, which would look something like this:
Code:
$ ./script1.sh
++ date +%A
+ day=vrijdag
++ date +%d-%b-%Y
+ date_format=30-aug-2013
.
.
.
Apologies for the delay in response.
I say attachment means I say that I am not getting email with those two files.
Yes I looked in the email there is nothing in that.
Quote:
begin 640 script1-part-1_31-Aug-2013.csv
<unreadable stuff>
end
begin 640 script1-part-2_31-Aug-2013.csv
<unreadable stuff>
end
Instead of 640 I see 700 because I have explicitly changed the permissions. yes I could see like that, why you ask? Is that the reason it is unable to send an attachment?
Further investigation reveals that even if I do something like this
I am not getting email at all? However same email can be sent "outside" the shell script. I did echo $? just after this command and get return code as 0 ! all confusing
Last edited by sysmicuser; 08-31-2013 at 09:02 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.