LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-21-2012, 08:37 PM   #1
gundambob646
LQ Newbie
 
Registered: Apr 2012
Posts: 1

Rep: Reputation: Disabled
Mail looping script and automation help


Hell guys

I decided to make a rather simple looping script, however for some reason i can't automate the . and enter. Those are required to send the emails from the terminal. I tried using the \n but nothing.

Thanks for the help, heres the script.


#!/bin/bash

for (( c=0; c<2; c++ )) do

SUBJECT="Security Breach!!"
TO="emailaddress@hotmail.com"
MESSAGE="textFile.txt"

echo "Security Breach!" >> $MESSAGE
echo "Time: `date`" >> $MESSAGE

/usr/bin/mail -s "$SUBJECT" "$TO"

\n

done
 
Old 04-21-2012, 11:59 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,111

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
i think
Code:
cat $MESSAGE | /usr/bin/mail -s "$SUBJECT" "$TO
should work.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
looping in script fw12 Programming 3 11-04-2009 03:48 PM
looping startup script kirukan Linux - Newbie 3 07-10-2009 02:25 PM
Mail is looping back alitrix Linux - Server 18 10-19-2008 04:29 AM
Looping a script Keentolearn Linux - Newbie 4 01-30-2007 03:54 PM
Qmail - Backup server looping mail ziggie216 Linux - Software 0 10-04-2005 12:44 PM


All times are GMT -5. The time now is 06:45 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration