unary operator expected
Clifton Royston
cliftonr at tikitechnologies.com
Tue May 3 16:26:47 PDT 2005
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 at 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
More information about the freebsd-questions
mailing list