Jacob Meuser wrote:

> #!/bin/sh
> 
> TEMPDIR=`mktemp -d`
> 
> while read addr junk
> do
>       dom=`echo $addr | cut -d '@' -f 2`
>       echo $addr OK >> $TEMPDIR/$dom
> done
> 
> MYDIR=`pwd`
> cd $TEMPDIR
> 
> for i in *
> do
>       sort $i
>       echo $i REJECT
> done
> 
> cd $MYDIR
> rm -rf $TEMPDIR
> 
> exit 0

Very good! (-:

May I suggest one small improvement?  Set up a trap handler to delete
the temp dir.  That way it'll be cleaned up even if the script is
interrupted (e.g., you pipe the output through less and quit before
reaching the end).

    #!/bin/sh
    TEMPDIR="`mktemp -d`"
    trap 'rm -rf "$TEMPDIR"' EXIT
    # ... rest of script ...

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     [EMAIL PROTECTED]
_______________________________________________
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug

Reply via email to