From owner-freebsd-questions Tue Aug 14 16:41:11 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail.utexas.edu (wb2-a.mail.utexas.edu [128.83.126.136]) by hub.freebsd.org (Postfix) with SMTP id 95B4337B409 for ; Tue, 14 Aug 2001 16:41:05 -0700 (PDT) (envelope-from oscars@mail.utexas.edu) Received: (qmail 7475 invoked by uid 0); 14 Aug 2001 23:40:58 -0000 Received: from dhcp-199-210.dsl.utexas.edu (HELO oscar.mail.utexas.edu) (128.83.199.210) by umbs-smtp-2 with SMTP; 14 Aug 2001 23:40:58 -0000 Message-Id: <5.1.0.14.2.20010814184204.00a6e040@mail.utexas.edu> X-Sender: oscars@mail.utexas.edu X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 14 Aug 2001 18:45:38 -0500 To: freebsd-questions@freebsd.org, Drew Tomlinson From: Oscar Ricardo Silva Subject: RE: Shell Script Help - Comparing Strings In-Reply-To: <5CD46247635BD511B6B100A0CC3F023925A06A@ldcmsx01.lc.ca.gov> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed 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 He meant to try: if ["$1"==""] then $1 = "www" fi The difference is that "=" sets the value of something ex. x = 2 sets the value of x to 2 while "==" is for comparing values ex. x set to 2 and y set to 4 if [ x == y] is false Oscar At 03:50 PM 08/14/2001 -0700, Drew Tomlinson, you wrote: > > -----Original Message----- > > From: Linh Pham [mailto:lplist@closedsrc.org] > > Sent: Tuesday, August 14, 2001 3:48 PM > > To: Drew Tomlinson > > Cc: FreeBSD Questions (E-mail) > > Subject: Re: Shell Script Help - Comparing Strings > > > > > > On 2001-08-14, Drew Tomlinson scribbled: > > > > # #! /bin/sh -vx > > # > > # # 8/8/01 > > # # An attempt to write script to run webalizer to generate > > web stats for all > > # # virtual web sites. > > # > > # # Set command line variables. $1 = web to run. > > # > > # # Set $1 to "www" if blank. > > # echo $1 > > # if ["$1"=""] > > # then $1 = "www" > > # fi > > > > Have you tried: > > > > if ["$1"==""] > > > > instead of just having = > >No I hadn't but it doesn't seem to help: > >if ["$1"==""] > then $1 == "www" >fi >+ [test==] >[test==]: not found > >What's the difference between "=" and "=="? > >Thanks, > >Drew > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message