[oe] Use of == in shell scripts
msmith at cbnco.com
Tue Oct 26 18:21:39 CEST 2010
Andreas Oberritter wrote:
> On 10/26/2010 05:51 PM, Maupin, Chase wrote:
> I understand that bash is a requirement for now, but if possible, that
> should be changed. I don't think that root access to a machine should be
> necessary to build OE on Ubuntu (or maybe even on BSD flavors).
Well, maybe Ubuntu should be changed to use bash :)
>> If I remember correctly in bash "==" will also work with numbers whereas "=" is only for strings.
> Both bash and dash on my system handle "[ "0" = 0 ]" or [ "0" = 1 ]
> correctly. Another operator "-eq" exists, which is only for numbers.
From what I can see, it looks like = and == are equivalent in bash, so
we should use = so we're not tied to bash.
-eq is for numeric comparison. For example, [ 01 -eq 1 ] but not
[ "01" = "1" ].
More information about the Openembedded-devel