From owner-freebsd-questions Wed Aug 8 11:44:56 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mailg.telia.com (mailg.telia.com [194.22.194.26]) by hub.freebsd.org (Postfix) with ESMTP id 4D4E437B412 for ; Wed, 8 Aug 2001 11:44:51 -0700 (PDT) (envelope-from ertr1013@student.uu.se) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by mailg.telia.com (8.11.2/8.11.0) with ESMTP id f78Iims17649 for ; Wed, 8 Aug 2001 20:44:48 +0200 (CEST) Received: from ertr1013.student.uu.se (h185n2fls20o913.telia.com [212.181.163.185]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id UAA19560 for ; Wed, 8 Aug 2001 20:44:48 +0200 (CEST) Received: (qmail 22110 invoked by uid 1001); 8 Aug 2001 18:43:36 -0000 Date: Wed, 8 Aug 2001 20:43:36 +0200 From: Erik Trulsson To: Drew Tomlinson Cc: "FreeBSD Questions (E-mail)" Subject: Re: Scripting Help Message-ID: <20010808204336.A22075@student.uu.se> Mail-Followup-To: Drew Tomlinson , "FreeBSD Questions (E-mail)" References: <5CD46247635BD511B6B100A0CC3F023925A04F@ldcmsx01.lc.ca.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5CD46247635BD511B6B100A0CC3F023925A04F@ldcmsx01.lc.ca.gov> User-Agent: Mutt/1.3.20i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Aug 08, 2001 at 11:37:02AM -0700, Drew Tomlinson wrote: > I'm attempting to write one of my first scripts. What I want to do is > create a simple script that I can pass arguments to from the command line > and have it run the appropriate webalizer command(s) to create stats for > various virtual hosts on my machine. However, I am running into problems > figuring out how to set variables in the script. Here is what I have so > far: > > #! /bin/sh > > # 8/8/01 > # An attempt to write script to run webalizer to generate web stats for all > # virtual web sites. > > # Set command line variables > set web=$1 > set odir="/usr/local/www/data/webalizer/$1" No need to use 'set'. Those lines should just read: web=$1 odir="/usr/local/www/data/webalizer/$1" > > # Time stamp log > date > > echo $web\n > echo $odir\n The \n at the shouldn't be there. The default behaviour for echo(1) is to add a newline at the end. (Can be overridden by the -n flag.) So this should be echo $web echo $odir > exit > > When run, this is my output: > > blacklamb# ./webalizer_run.sh test > Wed Aug 8 11:26:40 PDT 2001 > n > n > blacklamb# > > What I expect to happen is that the variable "web" is set to "test" and the > variable "odir" is set to "/usr/local/www/data/webalizer/test". Then the > echo line print the settings to confirm. Once I get this part "dialed in", > then I plan to use the variable in a line such as "webalizer -O $odir". > > So can anyone enlighten me as to what I'm missing? Any links, RTFMs, etc. > to scripting help is appreciated. > -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message