Why /bin/sh doesn't like the line: if test "x$my_var" == "xyes"; then

Bertram Scharpf lists at bertram-scharpf.de
Thu Sep 3 11:50:22 UTC 2009


Hi,

Am Donnerstag, 03. Sep 2009, 04:14:56 +0000 schrieb jerry M:
> configure file got this line and it causes the message: test:
> xyes: unexpected operator But removing spaces around == or
> replacing == with = makes it to work.
> 
> On Linux though this line works fine.

As `man test' describes, the /bin/test executable does not
recognize a == operator.

Neither in `sh' nor in `bash' the `test' executable will be called
(unless written as /bin/test). In both cases it is a builtin
command. The Sh builtin works like the `test' executable; the Bash
builtin recognizes ==.

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de


More information about the freebsd-questions mailing list