[oe] Use of == in shell scripts
Maupin, Chase
chase.maupin at ti.com
Tue Oct 26 15:51:04 UTC 2010
> -----Original Message-----
> From: openembedded-devel-bounces at lists.openembedded.org
> [mailto:openembedded-devel-bounces at lists.openembedded.org] On Behalf Of
> Andreas Oberritter
> Sent: Tuesday, October 26, 2010 10:31 AM
> To: openembedded-devel at lists.openembedded.org
> Subject: [oe] Use of == in shell scripts
>
> Dear all,
>
> I noticed a common mistake in various OE recipes, classes and contrib
> scripts: Instead of =, == is used as equality operator, in at least 91
> places in 64 files (without recipes/obsolete: 83 in 60 files). This
> isn't a problem with bash, but it isn't the standard syntax and at least
> dash does not support it.
Isn't bash the supported shell? If I remember correctly in bash "==" will also work with numbers whereas "=" is only for strings.
>
> I used the following command line to find the occurences:
>
> git grep 'if\s*\[.*==.*\]'
>
> This command fixes all occurences:
>
> for i in `git grep -l 'if\s*\[.*==.*\]'`; do
> sed -i $i -e 's,\(if\s*\[.*\)==\(.*\]\),\1=\2,';
> done
>
> One of the matches is a false positive:
> recipes/uclibc/uclibc-0.9.29/uClibc-0.9.29-nonposix_bashisms.patch
>
> How do I submit such a patch? 60 patches may be too much for such a
> relatively simple change, but, on the other hand, everything in a single
> patch may be unhandy as well.
>
> How about splitting it into 5 patches?
>
> - classes (7 files)
> - contrib (4 files)
> - recipes/*/*.bb (24 files)
> - recipes/*/*.inc (14 files)
> - other files in recipes except recipes/obsolete (11 files)
>
> Any opinions?
>
> Regards,
> Andreas
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
More information about the Openembedded-devel
mailing list