Sunday, 11 August 2013

Linux command "test" from coreutils has a bug?

Linux command "test" from coreutils has a bug?

something goes wrong with bash command or with my head.
This is a simple script I've wrote:
#! /usr/bin/bash
a="aaa"
b="bbb"
echo -n "String a='$a' and string b='$b'. So, "
if [ "$a"="$b" ]; then
echo "string is equal."
else
echo "string is NOT equal."
fi
So, I run the script and.... TADAAAAA:
[felice@matrix ~]$ ./script
String a='aaa' and string b='bbb'. So, string is equal.
[felice@matrix ~]$
Why? Is a bug of coreutils test command? If I substitute [ ... ] with test
command, nothing change.
My coreutils version is 8.21.
Regards.

No comments:

Post a Comment