From owner-freebsd-questions@FreeBSD.ORG Tue May 3 23:26:47 2005 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 10E5016A4CE for ; Tue, 3 May 2005 23:26:47 +0000 (GMT) Received: from malasada.lava.net (malasada.lava.net [64.65.64.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE5CE43D67 for ; Tue, 3 May 2005 23:26:46 +0000 (GMT) (envelope-from cliftonr@lava.net) Received: by malasada.lava.net (Postfix, from userid 102) id 10EB3153882; Tue, 3 May 2005 13:26:45 -1000 (HST) Date: Tue, 3 May 2005 13:26:44 -1000 From: Clifton Royston To: Chris Burchell Message-ID: <20050503232643.GB13135@tikitechnologies.com> Mail-Followup-To: Chris Burchell , freebsd-questions@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i cc: freebsd-questions@freebsd.org Subject: Re: unary operator expected 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: Tue, 03 May 2005 23:26:47 -0000 On Tue, May 03, 2005 at 05:13:47PM -0600, Chris Burchell wrote: > I'm working with a script written for Linux that has the following > lines: > > # Check that networking is up. > [ ${NETWORKING} = "no" ] && exit 0 I don't think it's a Linux/BSD issue. This line won't work in sh if NETWORKING is unset. Then you get (after parameter expansion) [ = "no" ] && exit 0 which fails the syntax check. I suspect "NETWORKING" always happened to be set in the Linux environment you were running it under, or perhaps you were using a different shell. > Can anyone help with suggestions or an alternate statement that will > work on FreeBSD 5.3-RELEASE? One time-honored idiom is: [ "X${NETWORKING}" = "Xno" ] && exit 0 or you can just make sure that NETWORKING always gets set to some value. -- Clifton -- Clifton Royston -- cliftonr@tikitechnologies.com Tiki Technologies Lead Programmer/Software Architect "I'm gonna tell my son to grow up pretty as the grass is green And whip-smart as the English Channel's wide..." -- 'Whip-Smart', Liz Phair