Friday, May 20, 2005

Mad at bash

Something strange is happening with my shell, and it is bad because it makes kde configure fail, let's see if someone can help me and tell me why

x=`gcc -print-prog-name=ld`
y=ld
echo $x
echo $y
if test $x = $y; then
echo equal
else
echo not equal
fi

gives me this result

$ ./test.sh
ld
ld
not equal

I'm deseperate :-(

Update: I've fixed it now, it was a hack i did to colorgcc to make it work with unsermake that was making gcc return "strange" things. Thanks to all that ofered help both here and in #kde-devel

4 comments:

Anonymous said...

has probao con == o con -eq , e incluso con "x$x" == "x$y"?

y a encerrarlos entre corchetes ?

saludos

Anonymous said...

Works perfectly fine here.

sh -x ./test.sh
++ gcc -print-prog-name=ld
+ x=ld
+ y=ld
+ echo ld
ld
+ echo ld
ld
+ test ld = ld
+ echo equal
equal

Anonymous said...

You may want to check the values for extra whitespace:
echo \"$x\"
echo \"$y\"

Anonymous said...

tried it with bash and dash - both work fine.

what version of bash do you use?