From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=gwms/s4j; spf=pass (domain: linaro.org, ip: 209.85.221.66, mailfrom: leif.lindholm@linaro.org) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by groups.io with SMTP; Wed, 17 Jul 2019 07:04:55 -0700 Received: by mail-wr1-f66.google.com with SMTP id n9so24983993wrr.4 for ; Wed, 17 Jul 2019 07:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zCobHFfOsVXRQ80eoXmYnJwYexMidn63JwaoQu8F5Fg=; b=gwms/s4jpG5tQj9P7gRI439xMF3GLMGZPdgT97Hm69z6k9omAX0okElf3RWmhUKVmn 8ehUdG2aC5CeO77Shl7XAYitVGngg64kOL/zgZ3NNyKgSQR2KKfQ3Uns9CbG5GFOw4Cc BWtDDe5l80SBN2BPZrASyuddajVEiD8HuWgUMQzK7OpB9RTjFalbyKA9uCas1w3QRy7W hVBggAs3Rcch88xeMrRI1jYjS+s4o08S4H97jEosQhyPn3L6hgmjomso6bzz6i3gGtIa JKQuzmUmDnRy2j+r/RAFfMOWo9uIA34em3kkOr642jGtem65logwCsZT4R2EvfOtRCIA 6SaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zCobHFfOsVXRQ80eoXmYnJwYexMidn63JwaoQu8F5Fg=; b=QqfR3nggzVmaltgQKkjtlQYcHSJTRRK5vlb/7TmjSaNB+afetQ9HdnjEWvJ+8n0lRj G9SVEiPKLEmfEYcpbZgQ6YE/blfzPctATIkLzwx8oBMmxqYFyFHtafA6T28TZEVhgmLZ a+pMNzmik8YIFEhaGgPyD94fJZszU2HkF6+3nowuozWr9p29v5Mi8ScDT4SZmgLWe+b4 IQ5KJGR0/1XkAtxrfKCmiMRoKzvWbpsc8ZHod05KRc4a7iqnMgJMHiIxzpToGDmbT/23 fWAYtVhVQGD7FqrY+a6H0NsPBNtp+ZDWvj2s9Z36OgtRwI0DoTSqaN0yvKgde3nz2vjt lqeg== X-Gm-Message-State: APjAAAXlaRxLlqCLBZA/2I6E2Yk48VhokLAn5lpl1NbIxUMCgYOM2cau 80Y9Qcwlvpn04CHKmJm7OYZAXA== X-Google-Smtp-Source: APXvYqyKKt3aw9dpxFhAVZHaRRXJFIu1L9aeHnniH0WFjNLj59uV9vyxUuAge4rlsNIsa4en2F3Dow== X-Received: by 2002:adf:ed0e:: with SMTP id a14mr42685102wro.259.1563372293351; Wed, 17 Jul 2019 07:04:53 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id n14sm41053469wra.75.2019.07.17.07.04.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Jul 2019 07:04:52 -0700 (PDT) Date: Wed, 17 Jul 2019 15:04:51 +0100 From: "Leif Lindholm" To: Rebecca Cran 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 Message-ID: <20190717140451.GB2712@bivouac.eciton.net> References: <20190716190754.25412-1-leif.lindholm@linaro.org> <08f3b643-0622-7db4-ad28-e1145f053384@bsdio.com> MIME-Version: 1.0 In-Reply-To: <08f3b643-0622-7db4-ad28-e1145f053384@bsdio.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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