From owner-freebsd-questions@FreeBSD.ORG Fri Apr 18 11:32:58 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A730037B401 for ; Fri, 18 Apr 2003 11:32:58 -0700 (PDT) Received: from smtp-out.comcast.net (smtp-out.comcast.net [24.153.64.116]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2633343F75 for ; Fri, 18 Apr 2003 11:32:58 -0700 (PDT) (envelope-from gsam@trini0.org) Received: from hivemind.trini0.org (bgp626680bgs.brick201.nj.comcast.net [68.39.132.244]) by mtaout01.icomcast.net (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HDJ00IOCY45F5@mtaout01.icomcast.net> for questions@freebsd.org; Fri, 18 Apr 2003 14:31:17 -0400 (EDT) Received: from trini0.org (gladiator.trini0.org [192.168.0.3]) by hivemind.trini0.org (Postfix) with ESMTP id 20D9B43B for ; Fri, 18 Apr 2003 14:31:17 -0400 (EDT) Date: Fri, 18 Apr 2003 14:31:17 -0400 From: Gerard Samuel To: FreeBSD Questions Message-id: <3EA04475.6060408@trini0.org> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en, th User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3) Gecko/20030417 Subject: My first shell script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2003 18:32:59 -0000 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