Assistance with writing a shell script.

From: Glenn Prince (gprince_at_sealy.com.au)
Date: 10/01/04

  • Next message: sunlist: "strange who problem on V100 after cluster patch"
    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


  • Next message: sunlist: "strange who problem on V100 after cluster patch"

    Relevant Pages

    • Re: Improving my script
      ... Here is the updated script example...WATCH WRAPPING! ... I plan on creating a control file that contains the server name, ... Dim oMsg, oConf, oFields ... Set oConf = CreateObject ...
      (microsoft.public.scripting.vbscript)
    • Re: Re (3): automating x permission on a file & some [OT] chatter.
      ... Really I meant that the ETHO operating system would ... The mere presence of a static control file can never make a freshly ... Then a script could read the file, extract the checksum, name, ... would first make the script executable and then apply the interpreter. ...
      (Debian-User)
    • Re: [SLE] SuSE 8.2 and hwscan on boot
      ... looked at /var/log/messages and found oops in a ... retrieve it, so I could get the latest kernels booted. ... This script also ... > Would someone please remind me which control file, and where it resides, ...
      (SuSE)
    • Re: [SLE] SuSE 8.2 and hwscan on boot
      ... >> Would someone please remind me which control file, ... >> resides, that needs to be massaged to stop the hardware scan on boot. ... > your script is invoked: ...
      (SuSE)