Assistance with writing a shell script.
From: Glenn Prince (gprince_at_sealy.com.au)
Date: 10/01/04
- Previous message: Eyal edri: "Error in finishing a jumpstart install of Solaris 9"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: <sunmanagers@sunmanagers.org> Date: Fri, 1 Oct 2004 14:55:54 +1000
Hi all,
This isn't a strict Sun issue but I'm basicly hitting the limit of my very
small Unix knowledge. Basicly I am running a solaris box with a content
filter on it. Now when the content filter picks up a "bad" e-mail, it moves
it to a quarantine directory on the system. I have a script that came with
the software that allows me to resend any messages that get block, but the
only bad thing is this script doesn't take into consideration multiple
e-mail recipients. I have tried modifying the script to now avail (the
looping doesn't work after I try it).
There are two files, a control file and a data file, that the software
generates each time it blocks an e-mail. The control file looks like this:
T<sender@somwhere.com>
F<reciever1@somewhere.com>
F<reciever2@somewhere.com>
F<reciever3@somewhere.com>
OSender Name
SThis is where the subject is
<<--Other Stuff -->>
The data file is a standard mail message file. Now the snippet I need to
modify on the resend code I think is this:
for i in AF*; do
HEADER=$i
DATA=DF`echo $HEADER|cut -c3-256`
FROM=`head -1 $i|cut -f2 -d\<|cut -f1 -d\>`
TO=`head -2 $i|tail -1|cut -f2 -d\<|cut -f1 -d\>`
SUBJECT=`head -4 $i|tail -1|cut -c2-256`
I modified it to this:
for i in AF*; do
HEADER=$i
DATA=DF`echo $HEADER|cut -c3-256`
FROM=`head -1 $i|cut -f2 -d\<|cut -f1 -d\>`
MESSAGENUM=`grep -c $i`
LINENUM=1
CURLINE=`expr $LINENUM + 1`
while [ $LINENUM -le MESSAGENUM ] do
TO=`head -$CURLINE $i|tail -1|cut -f2 -d\<|cut -f1 -d\>`
LINENUM=`expr $LINENUM + 1`
CURLINE=`expr $LINENUM + 1`
done
CURLINE=`expr $CURLINE
SUBJECT=`head -$CURLINE $i|tail -1|cut -c2-256`
And this screws the loop and the cut command. Any idea's why ?
And to also throw a spanner in the works, for some reason Outlook messages
will occasionally have the to line in the control file like this:
T<<email@address.com>>
So if you know a better way to solve both of those issues, other wise I
would be happy with just getting multiple recipients working.
Cheers
Glenn Prince
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
- Previous message: Eyal edri: "Error in finishing a jumpstart install of Solaris 9"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|