My first shell script

Gerard Samuel gsam at trini0.org
Fri Apr 18 11:32:59 PDT 2003


Well I had just installed mhonarc to turn a mailling list archive into 
html, and didn't know how to make the
process automagic.
I never wrote a shell script from scratch before, and came up with this 
after a brief search on Google for commands.
It does work, but Im just looking for critical comments to the script, 
to see if I can improve on it..
If not, its in the archive for others to use it.
Thanks
------------------------------------
#!/bin/sh
#
# To populate dev team mailinglist archive
#

date=`date '+%Y-%m'`

if test ! -d /files/www/data/list_archive/$date
then
    if test -s 
/usr/local/ecartis/lists/dev-team/archives/mbox/dev-team.$date
    then
        mkdir /files/www/data/list_archive/$date
        /usr/local/bin/mhonarc -outdir 
/files/www/data/list_archive/$date 
/usr/local/ecartis/lists/dev-team/archives/mbox/dev-team.$date
        chown -R www:www /files/www/data/list_archive/$date
    fi
    exit
else
    /usr/local/bin/mhonarc -outdir /files/www/data/list_archive/$date 
-add /usr/local/ecartis/lists/dev-team/archives/mbox/dev-team.$date
    chown -R www:www /files/www/data/list_archive/$date
fi
exit 0



More information about the freebsd-questions mailing list