unexpected operator .sh error
Sahil Tandon
sahil at FreeBSD.org
Tue Jun 1 03:22:04 UTC 2010
On Tue, 01 Jun 2010, Aiza wrote:
> Chris Hill wrote:
> >The open-square-bracket, [, is another name for test. IIRC the
> >equal sign is not valid in that context.
Using '=' within test(1) brackets should be fine.
> >Can you post the 'before' and 'after' versions of that part of
> >your script? It would help us in determining what the problem is.
>
> That hint got me to the correct line
>
> I had if [$1 = "basejail" ]; then
As noted by Chris and the sh(1) man page, '[' is a built-in equivalent
of test(1). The correct syntax for an expression inside those brackets
requires *spacing*, i.e. [ expression ], and not [expression ], as in
your example.
--
Sahil Tandon <sahil at FreeBSD.org>
More information about the freebsd-questions
mailing list