Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 May 2005 13:26:44 -1000
From:      Clifton Royston <cliftonr@tikitechnologies.com>
To:        Chris Burchell <cburchell@muttart.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: unary operator expected
Message-ID:  <20050503232643.GB13135@tikitechnologies.com>
In-Reply-To: <AF33154333460E439B317830E50C10490D6072@tmfsrv01.muttart.org>
References:  <AF33154333460E439B317830E50C10490D6072@tmfsrv01.muttart.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050503232643.GB13135>