Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Scott Garman <scott.a.garman@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/1] runqemu: replace bashism with working shell idiom
Date: Mon, 14 May 2012 19:18:04 -0700	[thread overview]
Message-ID: <4FB1BCDC.7010105@intel.com> (raw)
In-Reply-To: <48e888dd2f3cebd256476a7ddd90f2d1a88ad788.1337035611.git.peter.seebach@windriver.com>

On 05/14/2012 03:49 PM, Peter Seebach wrote:
> The =~ operator is not one of my favorites, not just due to portability
> issues, but because it's not well known, and a lot of people might
> not expect a regex operator.
>
> The canonical shell idiom for this is to use case with alternation
> and wildcards.  As a side note, if you are matching anything containing
> core-image-sato, you don't need to also check for core-image-sato-sdk.
>
> Signed-off-by: Peter Seebach<peter.seebach@windriver.com>

Thank you, Peter.

Acked-by: Scott Garman <scott.a.garman@intel.com>

> ---
>   scripts/runqemu |   13 +++++++------
>   1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 305e46a..fc7363f 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -300,14 +300,15 @@ findimage() {
>       # recently created one is the one we most likely want to boot.
>       filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs`
>       for name in $filenames; do
> -        if [ "$name" =~ core-image-sato-sdk -o \
> -              "$name" =~ core-image-sato     -o \
> -              "$name" =~ core-image-lsb      -o \
> -              "$name" =~ core-image-basic    -o \
> -              "$name" =~ core-image-minimal ]; then
> +        case $name in
> +        *core-image-sato* | \
> +        *core-image-lsb* | \
> +        *core-image-basic* | \
> +        *core-image-minimal* )
>               ROOTFS=$name
>               return
> -        fi	
> +            ;;
> +        esac
>       done
>
>       echo "Couldn't find a $machine rootfs image in $where."


-- 
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center



  reply	other threads:[~2012-05-15  2:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 22:49 [PATCH 0/1] runqemu: fix the tests for core-image-* Peter Seebach
2012-05-14 22:49 ` [PATCH 1/1] runqemu: replace bashism with working shell idiom Peter Seebach
2012-05-15  2:18   ` Scott Garman [this message]
2012-05-16 18:16 ` [PATCH 0/1] runqemu: fix the tests for core-image-* Saul Wold

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=4FB1BCDC.7010105@intel.com \
    --to=scott.a.garman@intel.com \
    --cc=openembedded-core@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