git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 014/14] t9362-mw-to-git-utf8.sh: use the $( ... ) construct for command substitution

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Apr 16, 2014, 17:29 UTC
Message-ID
<1397669398-25410-14-git-send-email-gitter.spiros@gmail.com>
In-Reply-To
<1397669398-25410-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
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done
and then carefully proof-read.
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh
index 37021e2..6b0dbda 100755
--- a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh
+++ b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh
@@ -70,8 +70,8 @@ test_expect_success 'The shallow option works with accents' '
 	test_path_is_file mw_dir_4/Main_Page.mw &&
 	(
 		cd mw_dir_4 &&
-		test `git log --oneline Néoà.mw | wc -l` -eq 1 &&
-		test `git log --oneline Main_Page.mw | wc -l ` -eq 1
+		test $(git log --oneline Néoà.mw | wc -l) -eq 1 &&
+		test $(git log --oneline Main_Page.mw | wc -l ) -eq 1
 	) &&
 	wiki_check_content mw_dir_4/Néoà.mw Néoà &&
 	wiki_check_content mw_dir_4/Main_Page.mw Main_Page
-- 
1.7.10.4
Previous: Elia PintoNext: Matthieu Moy
Message 14 of 16 in “howto-index.sh: use the $( ... ) construct for command substitution”
  1. 001/14 howto-index.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  2. 002/14 install-webdoc.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  3. 003/14 git-checkout.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  4. 004/14 git-clone.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  5. 005/14 git-commit.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  6. 006/14 git-fetch.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  7. 007/14 git-ls-remote.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  8. 008/14 git-merge.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  9. 009/14 git-repack.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  10. 010/14 git-resolve.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  11. 011/14 git-revert.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  12. 012/14 git-tag.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  13. 013/14 t9360-mw-to-git-clone.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  14. 014/14 t9362-mw-to-git-utf8.sh: use the $( ... ) construct for command substitutionElia Pinto, Apr 16, 2014
  15. Matthieu MoyApr 17, 2014
  16. Junio C HamanoApr 17, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.