Article View: alt.privacy.anon-server
Article #197983Re: Shell Script Question
From: TwistyCreek
Date: Sun, 04 Dec 2005 19:13
Date: Sun, 04 Dec 2005 19:13
85 lines
3823 bytes
3823 bytes
retired hobbyist wrote:
> I am trying to run mixmaster via a little shell script, which asks me for
> the file name of the file that I want mixmaster to mail.
>
> If I run the command in the konsole, it works, but if I run it with the
> shell, the shell doesn't seem to be interpreting the asterisk wildcard.
Something makes Mixmaster choke on Pan's file names when run outside the
console (from a script). Ran across the same problem myself. It might have
something to do with the @ character, but I'm not sure. Here's how I got
around it. Note, this is from memory I'm not near the box where I set this
up. Not cut and paste, so run at your own risk. ;)
####################################################
## Begin script to deal with Pan file names and send
## Mix messages from Pan's sendlater directory
####################################################
#!/bin/bash
cd ~/.pan/messages/folders/pan.sendlater
for a in `ls *.msg`
do
pynoner $a
mv $a tmp.msg
~/Mix/mixmaster tmp.msg
rm tmp.msg
done;
exit 0
###########################################
# End script
###########################################
The 'pynoner' command is a Python script I use to sanitize messages saved
with Pan's 'Send Later' option so I don't have to mess with different
posting profiles, remembering to remove signatures, stuff like that. I
just hit the "later" button and let cron check the folder from time to
time for messages. ;)
Here's a python script that should work. Again, from memory and untested
as it appears here.
#####################################################
# Begin pynoner - Python script to scrub normal posts
#####################################################
#! /usr/bin/python
import string
import os
import sys
lines = 0
infile = open(sys.argv[1], 'r')
message = infile.readlines()
infile.close()
outfile = open("tempfile.txt", 'w')
outfile.write('To: mail2news@dizum.com\n')
while (message[lines].strip()):
if message[lines].startswith('Subject: '):
outfile.write(message[lines])
if message[lines].startswith('Newsgroups: '):
outfile.write(message[lines])
if message[lines].startswith('References: '):
outfile.write(message[lines])
if message[lines].startswith('Followup-To: '):
outfile.write(message[lines])
lines+=1
for x in range(len(message[lines:])):
if message[lines].startswith('-- '):
outfile.close()
break
outfile.write(message[lines])
x += 1
lines += 1
outfile.close()
os.remove(sys.argv[1])
os.rename('tempfile.txt', sys.argv[1])
#####################################################
# End pynoner
#####################################################
Hope this helps! Hope it works too. ;)
Technical Details
Message-ID:
<EZ5AVA5Y38690.5926273148@twistycreek.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!news.dizum.com!sewer-output!mail2newsReferences:
<20051204174726.71683.qmail@web36405.mail.mud.yahoo.com>Show Full Headers
Complete Article Headers
Message-ID: <EZ5AVA5Y38690.5926273148@twistycreek.com> Subject: Re: Shell Script Question Date: Sun, 04 Dec 2005 19:13:23 +0000 From: TwistyCreek <anon@comments.header> References: <20051204174726.71683.qmail@web36405.mail.mud.yahoo.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!news.dizum.com!sewer-output!mail2news Newsgroups: alt.privacy.anon-server Comments: This message did not originate from the above address. It was automatically remailed by an anonymous re-mail service. If you do not wish to receive further messages from this re-mailer: Reply to admin@twistycreek.com with the subject: dest-block Mail-To-News-Contact: abuse@dizum.com Organization: mail2news@dizum.com Lines: 85