openembedded-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Oberritter <obi@opendreambox.org>
To: openembedded-devel@lists.openembedded.org
Subject: Re: Use of == in shell scripts
Date: Wed, 27 Oct 2010 01:36:25 +0200	[thread overview]
Message-ID: <4CC765F9.4090005@opendreambox.org> (raw)
In-Reply-To: <4CC701D0.5070702@cbnco.com>

On 10/26/2010 06:29 PM, Michael Smith wrote:
> Andreas Oberritter wrote:
>> On 10/26/2010 05:31 PM, Andreas Oberritter wrote:
>>> 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)
>>
>> Or how about those 37 patches?
>>
>> http://git.opendreambox.org/?p=obi/openembedded.git;a=shortlog;h=refs/heads/equality-operator
>>
>>
>> Rationale:
>> - bbclasses: 1 patch per file
>> - contrib and recipes: 1 patch per directory
> 
> For the series:
> 
> Acked-By: Michael Smith <msmith@cbnco.com>
> 
> Except this one:
> 
> http://git.opendreambox.org/?p=obi/openembedded.git;a=commitdiff;h=ad7b2c9ab0c305034c39d2efc5a52789965bb5c2
> 
> 
> where some lines had == twice, looks like your sed may not have caught it.

Thanks for spotting! I've updated the patch series and added your ack.

> BTW, some of the files have constructs like this:
> 
> if [ "x$HAS_MADWIFI" = "x1" ]
> 
> I think this "x" business is for old broken shells that can't handle an
> empty quoted string as the first argument. Does anyone know the standard
> well enough to say? I figure [ "" = "1" ] should be legal everywhere.
> This is just a pet peeve/bike shed on my part.

Autotools use constructs like that everywhere, so it's likely increasing
portability while decreasing readability.

A random forum post suggests that some versions of '[' have problems, if
the first operand equals '!' or '(' [1].

It's not easy to search for [ or test or x on google. ;-)

Regards,
Andreas

[1]
http://www.techtalkz.com/unix/78138-testing-equality-bash-scripts.html#post329122



  reply	other threads:[~2010-10-26 23:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26 15:31 Use of == in shell scripts Andreas Oberritter
2010-10-26 15:47 ` Andreas Oberritter
2010-10-26 16:29   ` Michael Smith
2010-10-26 23:36     ` Andreas Oberritter [this message]
2010-10-27  1:47       ` Mike Detwiler
2010-11-13 16:10       ` Andreas Oberritter
2010-11-14 23:40         ` Michael Smith
2010-10-26 15:51 ` Maupin, Chase
2010-10-26 16:03   ` Chris Larson
2010-10-26 16:11   ` Andreas Oberritter
2010-10-26 16:21     ` Michael Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CC765F9.4090005@opendreambox.org \
    --to=obi@opendreambox.org \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).