[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Openexr-devel] [Patch] Bashism in bootstrap scripts
From: |
David Aguilar |
Subject: |
Re: [Openexr-devel] [Patch] Bashism in bootstrap scripts |
Date: |
Wed, 25 Jul 2012 23:21:58 -0700 |
On Wed, Jul 25, 2012 at 10:44 PM, Piotr Stanczyk <address@hidden> wrote:
> Hi Andreas,
>
> Thanks for the patches. I had a quick look at them and noticed that the '=='
> operator has been replaced by '=' one. Could you provide a little more
> information as to the rationale behind this.
That is standard POSIX shell. "==" is actually a non-portable
operator, and some exotic shells will not understand it.
It's typical to see it used like this:
if test "$variable" = "value"
then
# they are equal
fi
I did not read the patch, but if it's doing:
if [ "$variable" = "value" ]
then
# ...
fi
Then I'd probably rewrite it to use the 'test' expression, but that's
because I'm very accustomed to the git/kernel style.
There's a whole list of various shell guidelines that are used on the
git project:
http://repo.or.cz/w/git.git/blob/HEAD:/Documentation/CodingGuidelines#l30
Portability is the reason. git runs on all sorts of exotic alpha,
solaris, aix, etc. unixes (where #!/bin/sh is seldom bash) so the
portability concerns are very high.
--
David