[PATCH 044/144] t4014-format-patch.sh: use the $( ... ) construct for command substitution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The Git CodingGuidelines prefer the $( ... ) construct for command
substitution instead of using the back-quotes, or grave accents (`..`).

The backquoted form is the historical method for command substitution,
and is supported by POSIX. However,all but the simplest uses become
complicated quickly. In particular,embedded command substitutions
and/or the use of double quotes require careful escaping with the backslash
character. Because of this the POSIX shell adopted the $(…) feature from
the Korn shell.

Signed-off-by: Elia Pinto <gitter.spiros@xxxxxxxxx>
---
 t/t4014-format-patch.sh |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 73194b2..f9ed598 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -43,7 +43,7 @@ test_expect_success setup '
 test_expect_success "format-patch --ignore-if-in-upstream" '
 
 	git format-patch --stdout master..side >patch0 &&
-	cnt=`grep "^From " patch0 | wc -l` &&
+	cnt=$(grep "^From " patch0 | wc -l) &&
 	test $cnt = 3
 
 '
@@ -52,7 +52,7 @@ test_expect_success "format-patch --ignore-if-in-upstream" '
 
 	git format-patch --stdout \
 		--ignore-if-in-upstream master..side >patch1 &&
-	cnt=`grep "^From " patch1 | wc -l` &&
+	cnt=$(grep "^From " patch1 | wc -l) &&
 	test $cnt = 2
 
 '
@@ -69,7 +69,7 @@ test_expect_success "format-patch doesn't consider merge commits" '
 	git checkout -b merger master &&
 	test_tick &&
 	git merge --no-ff slave &&
-	cnt=`git format-patch -3 --stdout | grep "^From " | wc -l` &&
+	cnt=$(git format-patch -3 --stdout | grep "^From " | wc -l) &&
 	test $cnt = 3
 '
 
@@ -77,7 +77,7 @@ test_expect_success "format-patch result applies" '
 
 	git checkout -b rebuild-0 master &&
 	git am -3 patch0 &&
-	cnt=`git rev-list master.. | wc -l` &&
+	cnt=$(git rev-list master.. | wc -l) &&
 	test $cnt = 2
 '
 
@@ -85,7 +85,7 @@ test_expect_success "format-patch --ignore-if-in-upstream result applies" '
 
 	git checkout -b rebuild-1 master &&
 	git am -3 patch1 &&
-	cnt=`git rev-list master.. | wc -l` &&
+	cnt=$(git rev-list master.. | wc -l) &&
 	test $cnt = 2
 '
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]