Re: [PATCH 1/4] hooks--pre-push.sample: prefer $() for command substitution
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Sep 18, 2020, 16:57 UTC
- Message-ID
- <CAPig+cSCqU2SDVNZB8_eTiV6j3La=ik-JeWp4dSma77mcv1Ccg@mail.gmail.com>
- In-Reply-To
- <ed1ade73281bb78ab3a1d4fd1291a951ca52f0b4.1600427894.git.liu.denton@gmail.com>
On Fri, Sep 18, 2020 at 7:19 AM Denton Liu <liu.denton@gmail.com> wrote:
Show 9 quoted lines
> The preferred form for a command substitution is $() over ``. Use this > form for the command substitution in the sample hook. > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > diff --git a/templates/hooks--pre-push.sample b/templates/hooks--pre-push.sample > @@ -41,7 +41,7 @@ do > - commit=`git rev-list -n 1 --grep '^WIP' "$range"` > + commit="$(git rev-list -n 1 --grep '^WIP' "$range")"
The double quotes around $(...) are unnecessary and just add noise.
> if [ -n "$commit" ]
If you're looking for style fixes, then this would be another candidate (using 'test' instead of '[').