[PATCH 07/10] t/t7001-mv.sh: use the $( ... ) construct for command substitution
- From
Elia Pinto <gitter.spiros@gmail.com>
- Date
- Jan 7, 2016, 13:51 UTC
- Message-ID
- <1452174710-28188-8-git-send-email-gitter.spiros@gmail.com>
- In-Reply-To
- <1452174710-28188-1-git-send-email-gitter.spiros@gmail.com>
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`.
The backquoted form is the traditional 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.
The patch was generated by:
for _f in $(find . -name "*.sh")
do
perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}"
doneand then carefully proof-read.
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> --- t/t7001-mv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 7b56081..51dd2b4 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -156,11 +156,11 @@ test_expect_success "Michael Cassar's test case" ' echo b > partA/outline.txt && echo c > papers/unsorted/_another && git add papers partA && - T1=`git write-tree` && + T1=$(git write-tree) && git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf && - T=`git write-tree` && + T=$(git write-tree) && git ls-tree -r $T | verbose grep partA/outline.txt '
-- 2.3.3.GIT