"if [ s1 > s2 ]" broken, writing a s2 file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello,
folowing that bug
https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/1400357,
I follow through to investigate and I found out
that whatever I try, when comparing 2 strings I always end up with a
file written to disk

>From the man page
test expression
     [ expression ]
[...]
s1 > s2       True if string s1 comes after s2 based on the ASCII
value of their characters.

when I try to use it:
a="ert"
b="aze"
if [ $a > $b ] ; then
echo yes
fi
if [ "aer" > "azer" ] ;then
echo yes
fi

I got 2 yes printed on screen whereas only one should and most
importantly I got 2 empty files written to disk: one called "aze", and
another one "azer"

so this "if syntax" is broken or I don't knwo how to use it.

Also it is really dangerous  to use a syntax similar to file
redirection and this is exactly what is happening here.

this is happening with 0.5.8 too
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux