[TAG] question and announcement, sort of...

Ben Okopnik ben at callahans.org
Tue Jul 13 19:55:09 MSD 2004


On Tue, Jul 13, 2004 at 04:08:01AM +0200, Robos wrote:
> Hiya Gang!
> I recently had an idea: there are several "one word a day" mailing-lists
> where you can learn new words in a language. So I thought to myself: how
> about a "one command a day" for all my linux newbie friends? I asked several
> people and they liked the idea, so this thing is now rolling for the 3rd
> week. I think that maybe an announcement in linuxgazette is reaching a wider
> audience. But there is one problem though: the text is in german! But I
> think nevertheless I can reach quite some people this way, germans or
> german-speaking (hi Ben, wanna practise? ;-).

Oh, man. I wish I had the time to spare. These days, I don't. :(

> Old posts and at the same time the log is here:
> http://vobcopy.org/cgi-bin/blosxom/one-cmd-a-day/index.html
> BUT when I get lots of people I need an automatic emailing-system.
> At the moment there are 2 groups of people. One is further in the "list of
> commands" than the other. So I need to write a new explanation for the
> advanced group, write their email-addressment (hi list, this command is
> about bla whereas that of yesterday dealt with blubb, but here it comes),
> address the email, attach the explanation (is in separate command.txt every
> time) and send it away. Then I go into my sent-mail folder, find the
> corresponding email to send to the lagging group, change the recipients and
> maybe correct the addressment and send it away.
> Can you help me automate this? So that it is expandable? I am a lousy
> bash-programmer and my solution would be fairly ugly. If some of the perl
> gurus could help me here, I'd be thankful!

Well, seems like setting up Mailman or another list manager would be the
answer - lots of flex for later expansion. However, here's a pretty
simple script that should do what you're asking:

----------------------------------------------------------------------
#!/bin/bash
# Created by Ben Okopnik on Tue Jul 13 11:45:09 EDT 2004

[ -z "$2" ] && { printf "Usage: ${0##*/} <list> <file> [file] ... \n"; exit; }

files=`echo "$@"|sed 's/^[^ ]* //'`

for n in `cat $1`; do cat $files|mail -s 'Command-a-day' $n; done
----------------------------------------------------------------------

You'll need a list containing the email addresses, one per line or space
separated, that you want to send it to (just the foo at bar.com ones, not the
longer versions), the "state of the union" message you want to send (lets
call it "comments.txt"), and your command.txt file. Given the above, you'd
run it like this:

cmd_a_day list.txt comments.txt command.txt

You'd need to run it twice, with the appropriate values for all of the
above parameters for your two lists. Note that you could mix and match more
stuff by adding more files at the end of the list; the concatenated result
is what will be sent to the specified list.


* Ben Okopnik * okopnik.freeshell.org * Editor-in-Chief, Linux Gazette *
-*- See the Linux Gazette in its new home: <http://linuxgazette.net> -*-




More information about the TAG mailing list