Skip to contentSkip to conversation

scripts:patch-kernel:bash syntax replace,correct one

PATCH In review Bhaskar Chowdhury 2 participants 5 messages Oct 25, 2019 – Nov 6, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts:patch-kernel:bash syntax replace,correct one

This patch will replace backquote to dollar parenthesis syntax for better readability.Corrected one.

---
 scripts/patch-kernel | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
scripts/patch-kernel +7 -7
index 033d5916797d..6f9443336f9a 100755
@@ -153,7 +153,7 @@ applyPatch () {
     echo "failed.  Clean up yourself."
     return 1;
   fi
-  if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
+  if [ "$(find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print)" ]
   then
     echo "Aborting.  Reject files found."
     return 1;
@@ -175,7 +175,7 @@ reversePatch () {
 		echo "failed.  Clean it up."
 		exit 1
 	fi
-	if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
+	if [ "$(find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print)" ]
 	then
 		echo "Aborting.  Reject files found."
 		return 1
@@ -189,7 +189,7 @@ reversePatch () {
 # set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
 # force $TMPFILEs below to be in local directory: a slash character prevents
 # the dot command from using the search path.
-TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
+TMPFILE=$(mktemp ./.tmpver.XXXXXX) || { echo "cannot make temp file" ; exit 1; }
 grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
 tr -d [:blank:] < $TMPFILE > $TMPFILE.1
 . $TMPFILE.1
@@ -200,7 +200,7 @@ then
     exit 1
 fi
 
-NAME=`grep ^NAME $sourcedir/Makefile`
+NAME=$(grep ^NAME $sourcedir/Makefil)
 NAME=${NAME##*=}
 
 echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($NAME)"
@@ -216,8 +216,8 @@ fi
 
 #echo "stopvers=$stopvers"
 if [ $stopvers != "default" ]; then
-	STOPSUBLEVEL=`echo $stopvers | cut -d. -f3`
-	STOPEXTRA=`echo $stopvers | cut -d. -f4`
+	STOPSUBLEVEL=$(echo $stopvers | cut -d. -f3)
+	STOPEXTRA=$(echo $stopvers | cut -d. -f4)
 	STOPFULLVERSION=${stopvers%%.$STOPEXTRA}
 	#echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/"
 else
@@ -306,7 +306,7 @@ if [ x$gotac != x ]; then
 		HIGHESTPATCH=0
 		for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
 		do
-			ACVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/'`
+			ACVALUE=$(echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/')
 			# Check it is actually a recognised patch type
 			findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break
 

--
2.20.1

#1 lore raw
Quoted 3 lines · Bhaskar Chowdhury

This patch will replace backquote to dollar parenthesis syntax for better readability.Corrected one.

Talking about the commit subject, which part is 'bash syntax' ?

One more thing,
"correct one" is not the correct way to send a new patch version.
See the patch submission from other people. The version number is enclosed in the square brackets.

[PATCH v2]

The commit subject should describe what it does in imperative mood.

https://patchwork.kernel.org/patch/11205593/

Quoted 66 lines
---
 scripts/patch-kernel | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
scripts/patch-kernel +7 -8
index 033d5916797d..6f9443336f9a 100755
@@ -153,7 +153,7 @@ applyPatch () {
     echo "failed.  Clean up yourself."
     return 1;
   fi
-  if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
+  if [ "$(find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print)" ]
   then
     echo "Aborting.  Reject files found."
     return 1;
@@ -175,7 +175,7 @@ reversePatch () {
                echo "failed.  Clean it up."
                exit 1
        fi
-       if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
+       if [ "$(find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print)" ]
        then
                echo "Aborting.  Reject files found."
                return 1
@@ -189,7 +189,7 @@ reversePatch () {
 # set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
 # force $TMPFILEs below to be in local directory: a slash character prevents
 # the dot command from using the search path.
-TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
+TMPFILE=$(mktemp ./.tmpver.XXXXXX) || { echo "cannot make temp file" ; exit 1; }
 grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
 tr -d [:blank:] < $TMPFILE > $TMPFILE.1
 . $TMPFILE.1
@@ -200,7 +200,7 @@ then
     exit 1
 fi
 
-NAME=`grep ^NAME $sourcedir/Makefile`
+NAME=$(grep ^NAME $sourcedir/Makefil)
 NAME=${NAME##*=}
 
 echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($NAME)"
@@ -216,8 +216,8 @@ fi
 
 #echo "stopvers=$stopvers"
 if [ $stopvers != "default" ]; then
-       STOPSUBLEVEL=`echo $stopvers | cut -d. -f3`
-       STOPEXTRA=`echo $stopvers | cut -d. -f4`
+       STOPSUBLEVEL=$(echo $stopvers | cut -d. -f3)
+       STOPEXTRA=$(echo $stopvers | cut -d. -f4)
        STOPFULLVERSION=${stopvers%%.$STOPEXTRA}
        #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/"
 else
@@ -306,7 +306,7 @@ if [ x$gotac != x ]; then
                HIGHESTPATCH=0
                for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
                do
-                       ACVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/'`
+                       ACVALUE=$(echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/')
                        # Check it is actually a recognised patch type
                        findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break
 
--
Quoted 2 lines

2.20.1

--
Best Regards
Masahiro Yamada

#2 lore raw
Quoted 14 lines · Masahiro Yamada
Quoted 3 lines · Bhaskar Chowdhury

This patch will replace backquote to dollar parenthesis syntax for better readability.Corrected one.

Talking about the commit subject, which part is 'bash syntax' ?

One more thing,
"correct one" is not the correct way to send a new patch version.
See the patch submission from other people. The version number is enclosed in the square brackets.

Quoted 7 lines

[PATCH v2]

The commit subject should describe what it does in imperative mood.

https://patchwork.kernel.org/patch/11205593/

You are right ..my mistake ..shouldn't have included the "correct one" ...and you are absolutely right..."bash syntax" is as vague and confusing .

Again , Would you mind if I send you the correct one with proper subject line and explained what changed.

Thanks for the heads up Masahiro!

Quoted 78 lines
Quoted 71 lines
---
 scripts/patch-kernel | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
scripts/patch-kernel +7 -8
index 033d5916797d..6f9443336f9a 100755
@@ -153,7 +153,7 @@ applyPatch () {
     echo "failed.  Clean up yourself."
     return 1;
   fi
-  if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
+  if [ "$(find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print)" ]
   then
     echo "Aborting.  Reject files found."
     return 1;
@@ -175,7 +175,7 @@ reversePatch () {
                echo "failed.  Clean it up."
                exit 1
        fi
-       if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
+       if [ "$(find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print)" ]
        then
                echo "Aborting.  Reject files found."
                return 1
@@ -189,7 +189,7 @@ reversePatch () {
 # set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
 # force $TMPFILEs below to be in local directory: a slash character prevents
 # the dot command from using the search path.
-TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
+TMPFILE=$(mktemp ./.tmpver.XXXXXX) || { echo "cannot make temp file" ; exit 1; }
 grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
 tr -d [:blank:] < $TMPFILE > $TMPFILE.1
 . $TMPFILE.1
@@ -200,7 +200,7 @@ then
     exit 1
 fi
 
-NAME=`grep ^NAME $sourcedir/Makefile`
+NAME=$(grep ^NAME $sourcedir/Makefil)
 NAME=${NAME##*=}
 
 echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($NAME)"
@@ -216,8 +216,8 @@ fi
 
 #echo "stopvers=$stopvers"
 if [ $stopvers != "default" ]; then
-       STOPSUBLEVEL=`echo $stopvers | cut -d. -f3`
-       STOPEXTRA=`echo $stopvers | cut -d. -f4`
+       STOPSUBLEVEL=$(echo $stopvers | cut -d. -f3)
+       STOPEXTRA=$(echo $stopvers | cut -d. -f4)
        STOPFULLVERSION=${stopvers%%.$STOPEXTRA}
        #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/"
 else
@@ -306,7 +306,7 @@ if [ x$gotac != x ]; then
                HIGHESTPATCH=0
                for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
                do
-                       ACVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/'`
+                       ACVALUE=$(echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/')
                        # Check it is actually a recognised patch type
                        findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break
 
--
Quoted 2 lines

2.20.1

--
Best Regards
Masahiro Yamada

#3 lore raw
Quoted 22 lines · Bhaskar Chowdhury
Quoted 20 lines · Masahiro Yamada
Quoted 3 lines · Bhaskar Chowdhury

This patch will replace backquote to dollar parenthesis syntax for better readability.Corrected one.

Talking about the commit subject, which part is 'bash syntax' ?

One more thing,
"correct one" is not the correct way to send a new patch version.
See the patch submission from other people. The version number is enclosed in the square brackets.

[PATCH v2]

The commit subject should describe what it does in imperative mood.

Quoted 7 lines
Quoted 1 line

https://patchwork.kernel.org/patch/11205593/

You are right ..my mistake ..shouldn't have included the "correct one" ...and you are absolutely right..."bash syntax" is as vague and confusing .

Again , Would you mind if I send you the correct one with proper subject line and explained what changed.

I will pick up the patch with the subject corrected but you do not need to send similar patches any more.

... is the correct syntax.
Even if $(...) is more readable,
the added value is quite small.

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw
Quoted 32 lines · Masahiro Yamada
Quoted 22 lines · Bhaskar Chowdhury
Quoted 20 lines · Masahiro Yamada
Quoted 3 lines · Bhaskar Chowdhury

This patch will replace backquote to dollar parenthesis syntax for better readability.Corrected one.

Talking about the commit subject, which part is 'bash syntax' ?

One more thing,
"correct one" is not the correct way to send a new patch version.
See the patch submission from other people. The version number is enclosed in the square brackets.

[PATCH v2]

The commit subject should describe what it does in imperative mood.

Quoted 7 lines
Quoted 1 line

https://patchwork.kernel.org/patch/11205593/

You are right ..my mistake ..shouldn't have included the "correct one" ...and you are absolutely right..."bash syntax" is as vague and confusing .

Again , Would you mind if I send you the correct one with proper subject line and explained what changed.

Quoted 7 lines

I will pick up the patch with the subject corrected but you do not need to send similar patches any more.

... is the correct syntax.
Even if $(...) is more readable,
the added value is quite small.

Okay , noted.

Quoted 6 lines
Signature · 3 lines
-- 
Best Regards
Masahiro Yamada