LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-27-2002, 06:24 PM   #1
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
bash to recognise CR/LF


hello LQ!

i finally broke down and started learning some bash scripting, but now i'm stuck...

i have a script that sends an email, whenever it greps a log file and finds denied. I'm using mutt to send the email...now i would call it from the script like so

`mutt blahblah@blahblah.com -s <subject> -CC <carbon copy> -i <dynamic file>`

.....that command works fine at the prompt but i have to sit there and hit return to "accept/verify" the information and then ' :wq " cause i'm using vi to edit with. i was wondering if it was possible to have the script throw those carriage returns after i call mutt <and also the " :wq ">.

if anyone knows how to do this...THANK YOU! or maybe even another mail agent that can be called from the command line but not as 'interactive'. I was thinking to use sendmail but i'm not sure how to pass the actual message to it via script... mutt uses ' -i '...anyway

thanks :)
 
Old 11-27-2002, 06:50 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
This works better: "egrep <logfile> -e "(term1|term2)" | mail -s <subject> <recip0> <recip1>" unless you persist wanting to rely on mutt.
 
Old 12-04-2002, 01:03 PM   #3
Arf
LQ Newbie
 
Registered: Dec 2002
Location: Under my desk
Posts: 6

Rep: Reputation: 0
I would like to suggest these:

uuencode $filenameIn $filenameOut | mail -s "subject" $email@domain.com

Where filenameIn and Out are the file you want to attach.

cat $filename | mail -s "subject" $email@domain.com

Hope this helps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't recognise a PCI card disc0tech Linux - Hardware 1 09-29-2005 08:49 PM
bash won't recognise "make"command suse 9.1 whoops Linux - Newbie 1 08-12-2005 06:17 AM
xscreensaver won't recognise password KPOM Slackware 1 05-04-2005 01:08 PM
Anyone recognise this? brundles Linux - General 5 03-24-2005 08:45 AM
Suse 8.2 won't recognise modem. lachlan Linux - Hardware 3 09-01-2003 05:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration