From: "Leif Lindholm" <leif.lindholm@linaro.org>
To: Rebecca Cran <rebecca@bsdio.com>
Cc: devel@edk2.groups.io, lersek@redhat.com, bob.c.feng@intel.com,
liming.gao@intel.com, michael.d.kinney@intel.com,
afish@apple.com
Subject: Re: [edk2-devel] [PATCH 1/1] edksetup.sh: rework python executable scanning
Date: Wed, 17 Jul 2019 15:04:51 +0100 [thread overview]
Message-ID: <20190717140451.GB2712@bivouac.eciton.net> (raw)
In-Reply-To: <08f3b643-0622-7db4-ad28-e1145f053384@bsdio.com>
On Tue, Jul 16, 2019 at 02:10:43PM -0600, Rebecca Cran wrote:
> On 2019-07-16 13:07, Leif Lindholm wrote:
> > + EXECUTABLE=`basename $file`
> > + VERSION=`echo $EXECUTABLE | sed 's/[^0-9.]//g'`
> > +
> > + MAJOR=`echo $VERSION | sed 's/\([0-9]*\)\.*.*/\1/'`
> > + MINOR=`echo $VERSION | sed 's/[0-9]*\.*\([0-9]*\).*/\1/'`
> > + PATCH=`echo $VERSION | sed 's/[0-9]*\.*[0-9]*\.*\([0-9]*\)/\1/'`
>
> Here and in other places, we should probably use $(...) instead of `...` .
>
> From http://mywiki.wooledge.org/BashFAQ/082 :
>
> " `...` is the legacy syntax required by only the very oldest of
> non-POSIX-compatible bourne-shells. There are several reasons to always
> prefer the $(...) syntax..."
>
> And https://wiki.bash-hackers.org/scripting/obsolete
I also liked http://mywiki.wooledge.org/BashFAQ/082, linked from that.
> "Both the |`COMMANDS`| and |$(COMMANDS)| syntaxes are specified by
> POSIX, but the latter is _greatly_ preferred, though the former is
> unfortunately still very prevalent in scripts."
You're absolutely right.
I have in the past written scripts both for ancient UNIXen and early
busybox, so have a habit to go lowest common denominator. But this is
a _bash_ script, so there's no good reason.
If we keep the function, I'll rewrite it as suggested - thanks!
/
Leif
next prev parent reply other threads:[~2019-07-17 14:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 19:07 [PATCH 1/1] edksetup.sh: rework python executable scanning Leif Lindholm
2019-07-16 20:10 ` [edk2-devel] " rebecca
2019-07-17 14:04 ` Leif Lindholm [this message]
2019-07-16 20:49 ` Laszlo Ersek
2019-07-16 22:04 ` Leif Lindholm
2019-07-17 3:23 ` Liming Gao
2019-07-17 10:21 ` Laszlo Ersek
2019-07-17 14:32 ` Liming Gao
2019-07-17 19:43 ` Laszlo Ersek
2019-07-17 22:37 ` Leif Lindholm
2019-07-18 16:48 ` [edk2-devel] " Liming Gao
2019-07-18 17:55 ` Leif Lindholm
2019-07-19 13:07 ` Liming Gao
2019-07-23 9:44 ` Leif Lindholm
2019-07-24 15:29 ` Liming Gao
2019-07-17 10:13 ` Laszlo Ersek
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-list 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=20190717140451.GB2712@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/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