git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elia Pinto <gitter.spiros@gmail.com>
To: git@vger.kernel.org
Cc: Elia Pinto <gitter.spiros@gmail.com>
Subject: [PATCH v2 011/142] t0020-crlf.sh: use the $( ... ) construct for command substitution
Date: Tue, 25 Mar 2014 10:22:32 -0700	[thread overview]
Message-ID: <1395768283-31135-12-git-send-email-gitter.spiros@gmail.com> (raw)
In-Reply-To: <1395768283-31135-1-git-send-email-gitter.spiros@gmail.com>

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.

The patch was generated by the simple script

for _f in $(find . -name "*.sh")
do
  sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 t/t0020-crlf.sh |   42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index e526184..d2e51a8 100755
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
@@ -20,14 +20,14 @@ test_expect_success setup '
 
 	git commit -m initial &&
 
-	one=`git rev-parse HEAD:one` &&
-	dir=`git rev-parse HEAD:dir` &&
-	two=`git rev-parse HEAD:dir/two` &&
-	three=`git rev-parse HEAD:three` &&
+	one=$(git rev-parse HEAD:one) &&
+	dir=$(git rev-parse HEAD:dir) &&
+	two=$(git rev-parse HEAD:dir/two) &&
+	three=$(git rev-parse HEAD:three) &&
 
 	for w in Some extra lines here; do echo $w; done >>one &&
 	git diff >patch.file &&
-	patched=`git hash-object --stdin <one` &&
+	patched=$(git hash-object --stdin <one) &&
 	git read-tree --reset -u HEAD &&
 
 	echo happy.
@@ -111,7 +111,7 @@ test_expect_success 'update with autocrlf=input' '
 		}
 	done &&
 
-	differs=`git diff-index --cached HEAD` &&
+	differs=$(git diff-index --cached HEAD) &&
 	test -z "$differs" || {
 		echo Oops "$differs"
 		false
@@ -135,7 +135,7 @@ test_expect_success 'update with autocrlf=true' '
 		}
 	done &&
 
-	differs=`git diff-index --cached HEAD` &&
+	differs=$(git diff-index --cached HEAD) &&
 	test -z "$differs" || {
 		echo Oops "$differs"
 		false
@@ -158,9 +158,9 @@ test_expect_success 'checkout with autocrlf=true' '
 			break
 		}
 	done &&
-	test "$one" = `git hash-object --stdin <one` &&
-	test "$two" = `git hash-object --stdin <dir/two` &&
-	differs=`git diff-index --cached HEAD` &&
+	test "$one" = $(git hash-object --stdin <one) &&
+	test "$two" = $(git hash-object --stdin <dir/two) &&
+	differs=$(git diff-index --cached HEAD) &&
 	test -z "$differs" || {
 		echo Oops "$differs"
 		false
@@ -184,9 +184,9 @@ test_expect_success 'checkout with autocrlf=input' '
 			git update-index -- $f
 		fi
 	done &&
-	test "$one" = `git hash-object --stdin <one` &&
-	test "$two" = `git hash-object --stdin <dir/two` &&
-	differs=`git diff-index --cached HEAD` &&
+	test "$one" = $(git hash-object --stdin <one) &&
+	test "$two" = $(git hash-object --stdin <dir/two) &&
+	differs=$(git diff-index --cached HEAD) &&
 	test -z "$differs" || {
 		echo Oops "$differs"
 		false
@@ -200,7 +200,7 @@ test_expect_success 'apply patch (autocrlf=input)' '
 	git read-tree --reset -u HEAD &&
 
 	git apply patch.file &&
-	test "$patched" = "`git hash-object --stdin <one`" || {
+	test "$patched" = "$(git hash-object --stdin <one)" || {
 		echo "Eh?  apply without index"
 		false
 	}
@@ -213,7 +213,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' '
 	git read-tree --reset -u HEAD &&
 
 	git apply --cached patch.file &&
-	test "$patched" = `git rev-parse :one` || {
+	test "$patched" = $(git rev-parse :one) || {
 		echo "Eh?  apply with --cached"
 		false
 	}
@@ -226,8 +226,8 @@ test_expect_success 'apply patch --index (autocrlf=input)' '
 	git read-tree --reset -u HEAD &&
 
 	git apply --index patch.file &&
-	test "$patched" = `git rev-parse :one` &&
-	test "$patched" = `git hash-object --stdin <one` || {
+	test "$patched" = $(git rev-parse :one) &&
+	test "$patched" = $(git hash-object --stdin <one) || {
 		echo "Eh?  apply with --index"
 		false
 	}
@@ -240,7 +240,7 @@ test_expect_success 'apply patch (autocrlf=true)' '
 	git read-tree --reset -u HEAD &&
 
 	git apply patch.file &&
-	test "$patched" = "`remove_cr <one | git hash-object --stdin`" || {
+	test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
 		echo "Eh?  apply without index"
 		false
 	}
@@ -253,7 +253,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' '
 	git read-tree --reset -u HEAD &&
 
 	git apply --cached patch.file &&
-	test "$patched" = `git rev-parse :one` || {
+	test "$patched" = $(git rev-parse :one) || {
 		echo "Eh?  apply without index"
 		false
 	}
@@ -266,8 +266,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' '
 	git read-tree --reset -u HEAD &&
 
 	git apply --index patch.file &&
-	test "$patched" = `git rev-parse :one` &&
-	test "$patched" = "`remove_cr <one | git hash-object --stdin`" || {
+	test "$patched" = $(git rev-parse :one) &&
+	test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || {
 		echo "Eh?  apply with --index"
 		false
 	}
-- 
1.7.10.4

  parent reply	other threads:[~2014-03-25 17:37 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25 17:22 [PATCH v2 000/142] Use the $( ... ) construct for command substitution instead of using the back-quotes Elia Pinto
2014-03-25 17:22 ` [PATCH v2 001/142] check-builtins.sh: use the $( ... ) construct for command substitution Elia Pinto
2014-03-25 19:57   ` Junio C Hamano
2014-03-25 20:32     ` David Kastrup
2014-03-26 12:19       ` Matthieu Moy
2014-03-25 20:36     ` Junio C Hamano
2014-03-25 20:38       ` Junio C Hamano
2014-03-26  6:57   ` Matthieu Moy
2014-03-25 17:22 ` [PATCH v2 002/142] git-am.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 003/142] git-pull.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 004/142] git-rebase--merge.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 005/142] git-rebase.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 006/142] git-stash.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 007/142] git-web--browse.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 008/142] unimplemented.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 009/142] t0001-init.sh: " Elia Pinto
2014-03-25 20:02   ` Junio C Hamano
2014-03-25 17:22 ` [PATCH v2 010/142] t0010-racy-git.sh: " Elia Pinto
2014-03-25 17:22 ` Elia Pinto [this message]
2014-03-25 17:22 ` [PATCH v2 012/142] t0025-crlf-auto.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 013/142] t0026-eol-config.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 014/142] t0030-stripspace.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 015/142] t0300-credentials.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 016/142] t1000-read-tree-m-3way.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 017/142] t1001-read-tree-m-2way.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 018/142] t1002-read-tree-m-u-2way.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 019/142] t1003-read-tree-prefix.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 020/142] t1004-read-tree-m-u-wf.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 021/142] t1020-subdirectory.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 022/142] t1050-large.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 023/142] t1100-commit-tree-options.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 024/142] t1401-symbolic-ref.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 025/142] t1410-reflog.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 026/142] t1511-rev-parse-caret.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 027/142] t1512-rev-parse-disambiguation.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 028/142] t2102-update-index-symlinks.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 029/142] t3030-merge-recursive.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 030/142] t3100-ls-tree-restrict.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 031/142] t3101-ls-tree-dirname.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 032/142] t3210-pack-refs.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 033/142] t3403-rebase-skip.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 034/142] t3511-cherry-pick-x.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 035/142] t3600-rm.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 036/142] t3700-add.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 037/142] t3905-stash-include-untracked.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 038/142] t3910-mac-os-precompose.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 039/142] t4006-diff-mode.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 040/142] t4010-diff-pathspec.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 041/142] t4012-diff-binary.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 042/142] t4013-diff-various.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 043/142] t4014-format-patch.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 044/142] t4036-format-patch-signer-mime.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 045/142] t4038-diff-combined.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 046/142] t4057-diff-combined-paths.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 047/142] t4116-apply-reverse.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 048/142] t4119-apply-config.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 049/142] t4204-patch-id.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 050/142] t5000-tar-tree.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 051/142] t5003-archive-zip.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 052/142] t5100-mailinfo.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 053/142] t5300-pack-object.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 054/142] t5301-sliding-window.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 055/142] t5302-pack-index.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 056/142] t5303-pack-corruption-resilience.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 057/142] t5304-prune.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 058/142] t5305-include-tag.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 059/142] t5500-fetch-pack.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 060/142] t5505-remote.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 061/142] t5506-remote-groups.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 062/142] t5510-fetch.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 063/142] t5515-fetch-merge-logic.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 064/142] t5516-fetch-push.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 065/142] t5517-push-mirror.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 066/142] t5520-pull.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 067/142] t5522-pull-symlink.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 068/142] t5530-upload-pack-error.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 069/142] t5537-fetch-shallow.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 070/142] t5538-push-shallow.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 071/142] t5550-http-fetch-dumb.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 072/142] t5551-http-fetch-smart.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 073/142] t5570-git-daemon.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 074/142] t5601-clone.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 075/142] t5700-clone-reference.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 076/142] t5710-info-alternate.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 077/142] t5900-repo-selection.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 078/142] t6001-rev-list-graft.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 079/142] t6002-rev-list-bisect.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 080/142] t6015-rev-list-show-all-parents.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 081/142] t6032-merge-large-rename.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 082/142] t6034-merge-rename-nocruft.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 083/142] t6132-pathspec-exclude.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 084/142] t7001-mv.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 085/142] t7003-filter-branch.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 086/142] t7004-tag.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 087/142] t7006-pager.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 088/142] t7103-reset-bare.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 089/142] t7406-submodule-update.sh: " Elia Pinto
2014-03-25 18:41 ` [PATCH v2 000/142] Use the $( ... ) construct for command substitution instead of using the back-quotes Junio C Hamano
2014-03-26  7:02   ` Matthieu Moy
2014-03-26  7:44     ` Eric Sunshine
2014-03-26  9:41       ` Elia Pinto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395768283-31135-12-git-send-email-gitter.spiros@gmail.com \
    --to=gitter.spiros@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).