[PATCH 02/10] t/t7406-submodule-update.sh: use the $( ... ) construct for command substitution
- From
Elia Pinto <gitter.spiros@gmail.com>
- Date
- Jan 8, 2016, 11:06 UTC
- Message-ID
- <1452251188-12939-3-git-send-email-gitter.spiros@gmail.com>
- In-Reply-To
- <1452251188-12939-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/t7406-submodule-update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index dda3929..68ea31d 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -14,8 +14,8 @@ submodule and "git submodule update --rebase/--merge" does not detach the HEAD. compare_head() { - sha_master=`git rev-list --max-count=1 master` - sha_head=`git rev-list --max-count=1 HEAD` + sha_master=$(git rev-list --max-count=1 master) + sha_head=$(git rev-list --max-count=1 HEAD) test "$sha_master" = "$sha_head" }
-- 2.3.3.GIT