* [PATCH] scripts: setlocalversion: fix shell syntax
@ 2019-10-12 4:53 Bhaskar Chowdhury
2019-10-16 2:37 ` Masahiro Yamada
0 siblings, 1 reply; 2+ messages in thread
From: Bhaskar Chowdhury @ 2019-10-12 4:53 UTC (permalink / raw)
To: yamada.masahiro, michal.lkml
Cc: linux-kbuild, nico-linuxsetlocalversion, rdunlap,
Bhaskar Chowdhury
This patch replace backquote to dollar parenthesis.
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
---
scripts/setlocalversion | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 220dae0db3f1..b82a29bfc78a 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -45,11 +45,11 @@ scm_version()
# Check for git and a git repo.
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
- head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+ head=$(git rev-parse --verify --short HEAD 2>/dev/null); then
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
# it, because this version is defined in the top level Makefile.
- if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
+ if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
# If only the short version is requested, don't bother
# running further git commands
@@ -59,7 +59,7 @@ scm_version()
fi
# If we are past a tagged commit (like
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
- if atag="`git describe 2>/dev/null`"; then
+ if atag="$(git describe 2>/dev/null)"; then
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
# If we don't have a tag at all we print -g{commitish}.
@@ -70,7 +70,7 @@ scm_version()
# Is this git on svn?
if git config --get svn-remote.svn.url >/dev/null; then
- printf -- '-svn%s' "`git svn find-rev $head`"
+ printf -- '-svn%s' "$(git svn find-rev $head)"
fi
# Check for uncommitted changes.
@@ -91,15 +91,15 @@ scm_version()
fi
# Check for mercurial and a mercurial repo.
- if test -d .hg && hgid=`hg id 2>/dev/null`; then
+ if test -d .hg && hgid=$(hg id 2>/dev/null); then
# Do we have an tagged version? If so, latesttagdistance == 1
- if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
- id=`hg log -r . --template '{latesttag}'`
+ if [ "$(hg log -r . --template '{latesttagdistance}')" == "1" ]; then
+ id=$(hg log -r . --template '{latesttag}')
printf '%s%s' -hg "$id"
else
- tag=`printf '%s' "$hgid" | cut -d' ' -f2`
+ tag=$(printf '%s' "$hgid" | cut -d' ' -f2)
if [ -z "$tag" -o "$tag" = tip ]; then
- id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+ id=$(printf '%s' "$hgid" | sed 's/[+ ].*//')
printf '%s%s' -hg "$id"
fi
fi
@@ -115,8 +115,8 @@ scm_version()
fi
# Check for svn and a svn repo.
- if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
- rev=`echo $rev | awk '{print $NF}'`
+ if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
+ rev=$(echo $rev | awk '{print $NF}')
printf -- '-svn%s' "$rev"
# All done with svn
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] scripts: setlocalversion: fix shell syntax
2019-10-12 4:53 [PATCH] scripts: setlocalversion: fix shell syntax Bhaskar Chowdhury
@ 2019-10-16 2:37 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2019-10-16 2:37 UTC (permalink / raw)
To: Bhaskar Chowdhury
Cc: Michal Marek, Linux Kbuild mailing list, Nico Schottelius,
Randy Dunlap
Hi Bhaskar,
I think the commit subject "scripts: setlocalversion: fix shell syntax"
is strange. This patch does not fix any bug.
`some_command` works as well as $(some-command)
Please describe "what this commit does" in the commit subject,
and "why this change is needed" in the commit description.
An example of the subject would be:
scripts: setlocalversion: replace backquote to dollar parenthesis
An example of the commit description might be:
This commit improves the code readability.
On Sat, Oct 12, 2019 at 1:54 PM Bhaskar Chowdhury <unixbhaskar@gmail.com> wrote:
>
> This patch replace backquote to dollar parenthesis.
>
> Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
> ---
> scripts/setlocalversion | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/setlocalversion b/scripts/setlocalversion
> index 220dae0db3f1..b82a29bfc78a 100755
> --- a/scripts/setlocalversion
> +++ b/scripts/setlocalversion
> @@ -45,11 +45,11 @@ scm_version()
>
> # Check for git and a git repo.
> if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
> - head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
> + head=$(git rev-parse --verify --short HEAD 2>/dev/null); then
This line is fine as-is.
> # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
> # it, because this version is defined in the top level Makefile.
> - if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
> + if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
>
> # If only the short version is requested, don't bother
> # running further git commands
> @@ -59,7 +59,7 @@ scm_version()
> fi
> # If we are past a tagged commit (like
> # "v2.6.30-rc5-302-g72357d5"), we pretty print it.
> - if atag="`git describe 2>/dev/null`"; then
> + if atag="$(git describe 2>/dev/null)"; then
> echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
>
> # If we don't have a tag at all we print -g{commitish}.
> @@ -70,7 +70,7 @@ scm_version()
>
> # Is this git on svn?
> if git config --get svn-remote.svn.url >/dev/null; then
> - printf -- '-svn%s' "`git svn find-rev $head`"
> + printf -- '-svn%s' "$(git svn find-rev $head)"
> fi
>
> # Check for uncommitted changes.
> @@ -91,15 +91,15 @@ scm_version()
> fi
>
> # Check for mercurial and a mercurial repo.
> - if test -d .hg && hgid=`hg id 2>/dev/null`; then
> + if test -d .hg && hgid=$(hg id 2>/dev/null); then
> # Do we have an tagged version? If so, latesttagdistance == 1
> - if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
> - id=`hg log -r . --template '{latesttag}'`
> + if [ "$(hg log -r . --template '{latesttagdistance}')" == "1" ]; then
> + id=$(hg log -r . --template '{latesttag}')
> printf '%s%s' -hg "$id"
> else
> - tag=`printf '%s' "$hgid" | cut -d' ' -f2`
> + tag=$(printf '%s' "$hgid" | cut -d' ' -f2)
> if [ -z "$tag" -o "$tag" = tip ]; then
> - id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
> + id=$(printf '%s' "$hgid" | sed 's/[+ ].*//')
> printf '%s%s' -hg "$id"
> fi
> fi
> @@ -115,8 +115,8 @@ scm_version()
> fi
>
> # Check for svn and a svn repo.
> - if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
> - rev=`echo $rev | awk '{print $NF}'`
> + if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
> + rev=$(echo $rev | awk '{print $NF}')
> printf -- '-svn%s' "$rev"
>
> # All done with svn
> --
> 2.21.0
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-16 2:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-12 4:53 [PATCH] scripts: setlocalversion: fix shell syntax Bhaskar Chowdhury
2019-10-16 2:37 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox