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

[PATCH v2 048/142] t4119-apply-config.sh: use the $( ... ) construct for command substitution

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Mar 25, 2014, 17:23 UTC
Message-ID
<1395768283-31135-49-git-send-email-gitter.spiros@gmail.com>
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/t4119-apply-config.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh
index 3d0384d..c393be6 100755
--- a/t/t4119-apply-config.sh
+++ b/t/t4119-apply-config.sh
@@ -68,7 +68,7 @@ test_expect_success 'apply --whitespace=strip from config' '
 	check_result sub/file1
 '
 
-D=`pwd`
+D=$(pwd)
 
 test_expect_success 'apply --whitespace=strip in subdir' '
 
-- 
1.7.10.4
Previous: Elia PintoNext: Elia Pinto
Message 56 of 101 in “Use the $( ... ) construct for command substitution instead of using the back-quotes”
  1. 000/142 Use the $( ... ) construct for command substitution instead of using the back-quotesElia Pinto, Mar 25, 2014
  2. 001/142 check-builtins.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  3. Junio C HamanoMar 25, 2014
  4. David KastrupMar 25, 2014
  5. Matthieu MoyMar 26, 2014
  6. Junio C HamanoMar 25, 2014
  7. Junio C HamanoMar 25, 2014
  8. Matthieu MoyMar 26, 2014
  9. 002/142 git-am.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  10. 003/142 git-pull.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  11. 004/142 git-rebase--merge.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  12. 005/142 git-rebase.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  13. 006/142 git-stash.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  14. 007/142 git-web--browse.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  15. 008/142 unimplemented.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  16. 009/142 t0001-init.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  17. Junio C HamanoMar 25, 2014
  18. 010/142 t0010-racy-git.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  19. 011/142 t0020-crlf.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  20. 012/142 t0025-crlf-auto.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  21. 013/142 t0026-eol-config.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  22. 014/142 t0030-stripspace.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  23. 015/142 t0300-credentials.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  24. 016/142 t1000-read-tree-m-3way.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  25. 017/142 t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  26. 018/142 t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  27. 019/142 t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  28. 020/142 t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  29. 021/142 t1020-subdirectory.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  30. 022/142 t1050-large.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  31. 023/142 t1100-commit-tree-options.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  32. 024/142 t1401-symbolic-ref.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  33. 025/142 t1410-reflog.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  34. 026/142 t1511-rev-parse-caret.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  35. 027/142 t1512-rev-parse-disambiguation.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  36. 028/142 t2102-update-index-symlinks.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  37. 029/142 t3030-merge-recursive.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  38. 030/142 t3100-ls-tree-restrict.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  39. 031/142 t3101-ls-tree-dirname.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  40. 032/142 t3210-pack-refs.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  41. 033/142 t3403-rebase-skip.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  42. 034/142 t3511-cherry-pick-x.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  43. 035/142 t3600-rm.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  44. 036/142 t3700-add.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  45. 037/142 t3905-stash-include-untracked.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  46. 038/142 t3910-mac-os-precompose.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  47. 039/142 t4006-diff-mode.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  48. 040/142 t4010-diff-pathspec.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  49. 041/142 t4012-diff-binary.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  50. 042/142 t4013-diff-various.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  51. 043/142 t4014-format-patch.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  52. 044/142 t4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  53. 045/142 t4038-diff-combined.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  54. 046/142 t4057-diff-combined-paths.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  55. 047/142 t4116-apply-reverse.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  56. 048/142 t4119-apply-config.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  57. 049/142 t4204-patch-id.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  58. 050/142 t5000-tar-tree.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  59. 051/142 t5003-archive-zip.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  60. 052/142 t5100-mailinfo.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  61. 053/142 t5300-pack-object.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  62. 054/142 t5301-sliding-window.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  63. 055/142 t5302-pack-index.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  64. 056/142 t5303-pack-corruption-resilience.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  65. 057/142 t5304-prune.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  66. 058/142 t5305-include-tag.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  67. 059/142 t5500-fetch-pack.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  68. 060/142 t5505-remote.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  69. 061/142 t5506-remote-groups.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  70. 062/142 t5510-fetch.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  71. 063/142 t5515-fetch-merge-logic.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  72. 064/142 t5516-fetch-push.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  73. 065/142 t5517-push-mirror.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  74. 066/142 t5520-pull.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  75. 067/142 t5522-pull-symlink.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  76. 068/142 t5530-upload-pack-error.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  77. 069/142 t5537-fetch-shallow.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  78. 070/142 t5538-push-shallow.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  79. 071/142 t5550-http-fetch-dumb.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  80. 072/142 t5551-http-fetch-smart.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  81. 073/142 t5570-git-daemon.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  82. 074/142 t5601-clone.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  83. 075/142 t5700-clone-reference.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  84. 076/142 t5710-info-alternate.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  85. 077/142 t5900-repo-selection.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  86. 078/142 t6001-rev-list-graft.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  87. 079/142 t6002-rev-list-bisect.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  88. 080/142 t6015-rev-list-show-all-parents.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  89. 081/142 t6032-merge-large-rename.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  90. 082/142 t6034-merge-rename-nocruft.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  91. 083/142 t6132-pathspec-exclude.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  92. 084/142 t7001-mv.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  93. 085/142 t7003-filter-branch.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  94. 086/142 t7004-tag.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  95. 087/142 t7006-pager.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  96. 088/142 t7103-reset-bare.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  97. 089/142 t7406-submodule-update.sh: use the $( ... ) construct for command substitutionElia Pinto, Mar 25, 2014
  98. Junio C HamanoMar 25, 2014
  99. Matthieu MoyMar 26, 2014
  100. Eric SunshineMar 26, 2014
  101. Elia PintoMar 26, 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.