LinuxQuestions.org
Visit Jeremy's Blog.
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 04-15-2005, 12:14 PM   #1
haze
LQ Newbie
 
Registered: Feb 2004
Posts: 16

Rep: Reputation: 0
Bash script - mailing list


I am trying to write a simple bash script which will function as a mailing list,
using the mail function and a seperate list of emails. For example:

maillist
person2@mymail.co.uk
person2@mymail.co.uk

newletter
This is a test newsletter

How do I use cat and mail commands to send a copy of the newsletter to all the emails in the email list. ?

cat newsletter | mail???
 
Old 04-15-2005, 12:36 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Something like this should work:
#!/bin/bash
IFS="
"
for address in `cat maillist`;do
cat newsletter | mail $address -s "Here is your newsletter"
done
 
Old 04-15-2005, 12:58 PM   #3
benjithegreat98
Senior Member
 
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019

Rep: Reputation: 45
One way is
mail -s "Da Subject" DaUser@domain.com < newsletter

You can use some sort of for loop to replace DaUser@domain.com with a user in a list you have.
 
Old 05-05-2005, 12:03 AM   #4
hicham007
LQ Newbie
 
Registered: May 2005
Location: canada
Distribution: SuSE 8.0
Posts: 9

Rep: Reputation: 1
a simple question about shell scripting

Hallo,
I m a shell scripting newbie, and i m trying to create a shell script that search for some files names 'script', those files are located in the subdirectory of a directory named "folder", and for each file founded, i have to show the directory (full path) where the file was founded and pipe the file to some program.
the script must be something like that:

for each file found in the subdirectory tree of "folder"
do
"show the full path where the file was found, without the file name, like /root/folder/images"
enter this directory already showed ($cd directory)
"pipe the file to a program"
done


Thanks for help!!
 
  


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
mailing list utility 62chevy Linux - Software 2 12-04-2006 07:57 PM
Mailing list subaruwrx Linux - Software 0 12-21-2004 09:38 AM
Slack mailing list.... r_jensen11 Slackware 4 02-06-2004 05:02 PM
Mailing list Manager... tarballed Linux - Software 0 08-29-2003 11:43 AM
know a c++ mailing list nakkaya Programming 1 07-02-2003 09:45 AM

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

All times are GMT -5. The time now is 10:32 AM.

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