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 002/144] git-am.sh: use the $( ... ) construct for command substitution
Date: Tue, 25 Mar 2014 01:24:07 -0700	[thread overview]
Message-ID: <1395735989-3396-3-git-send-email-gitter.spiros@gmail.com> (raw)
In-Reply-To: <1395735989-3396-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.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 git-am.sh |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index 78517f2..1b638e8 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -125,7 +125,7 @@ cannot_fallback () {
 }
 
 fall_back_3way () {
-    O_OBJECT=`cd "$GIT_OBJECT_DIRECTORY" && pwd`
+    O_OBJECT=$(cd "$GIT_OBJECT_DIRECTORY" && pwd)
 
     rm -fr "$dotest"/patch-merge-*
     mkdir "$dotest/patch-merge-tmp-dir"
@@ -275,7 +275,7 @@ split_patches () {
 		then
 			clean_abort "$(gettext "Only one StGIT patch series can be applied at once")"
 		fi
-		series_dir=`dirname "$1"`
+		series_dir=$(dirname "$1")
 		series_file="$1"
 		shift
 		{
@@ -298,8 +298,8 @@ split_patches () {
 		this=0
 		for stgit in "$@"
 		do
-			this=`expr "$this" + 1`
-			msgnum=`printf "%0${prec}d" $this`
+			this=$(expr "$this" + 1)
+			msgnum=$(printf "%0${prec}d" $this)
 			# Perl version of StGIT parse_patch. The first nonemptyline
 			# not starting with Author, From or Date is the
 			# subject, and the body starts with the next nonempty
@@ -644,26 +644,26 @@ fi
 git_apply_opt=$(cat "$dotest/apply-opt")
 if test "$(cat "$dotest/sign")" = t
 then
-	SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
+	SIGNOFF=$(git var GIT_COMMITTER_IDENT | sed -e '
 			s/>.*/>/
 			s/^/Signed-off-by: /'
-		`
+		)
 else
 	SIGNOFF=
 fi
 
-last=`cat "$dotest/last"`
-this=`cat "$dotest/next"`
+last=$(cat "$dotest/last")
+this=$(cat "$dotest/next")
 if test "$skip" = t
 then
-	this=`expr "$this" + 1`
+	this=$(expr "$this" + 1)
 	resume=
 fi
 
 while test "$this" -le "$last"
 do
-	msgnum=`printf "%0${prec}d" $this`
-	next=`expr "$this" + 1`
+	msgnum=$(printf "%0${prec}d" $this)
+	next=$(expr "$this" + 1)
 	test -f "$dotest/$msgnum" || {
 		resume=
 		go_next
@@ -739,16 +739,16 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."
 	'')
 	    if test '' != "$SIGNOFF"
 	    then
-		LAST_SIGNED_OFF_BY=`
+		LAST_SIGNED_OFF_BY=$(
 		    sed -ne '/^Signed-off-by: /p' \
 		    "$dotest/msg-clean" |
 		    sed -ne '$p'
-		`
-		ADD_SIGNOFF=`
+		)
+		ADD_SIGNOFF=$(
 		    test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
 		    test '' = "$LAST_SIGNED_OFF_BY" && echo
 		    echo "$SIGNOFF"
-		}`
+		})
 	    else
 		ADD_SIGNOFF=
 	    fi
-- 
1.7.10.4

  parent reply	other threads:[~2014-03-25  8:39 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25  8:24 [PATCH 000/144] Use the $( ... ) construct for command substitution instead of using the back-quotes Elia Pinto
2014-03-25  8:24 ` [PATCH 001/144] check-builtins.sh: use the $( ... ) construct for command substitution Elia Pinto
2014-03-25  8:35   ` Matthieu Moy
2014-03-25 10:03     ` Elia Pinto
2014-03-25  8:24 ` Elia Pinto [this message]
2014-03-25  8:24 ` [PATCH 003/144] git-pull.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 004/144] git-rebase--merge.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 005/144] git-rebase.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 006/144] git-stash.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 007/144] git-web--browse.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 008/144] unimplemented.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 009/144] t0001-init.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 010/144] t0010-racy-git.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 011/144] t0020-crlf.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 012/144] t0025-crlf-auto.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 013/144] t0026-eol-config.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 014/144] t0030-stripspace.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 015/144] t0204-gettext-reencode-sanity.sh: " Elia Pinto
2014-03-25  8:36   ` Matthieu Moy
2014-03-25  9:51     ` Elia Pinto
2014-03-25  8:24 ` [PATCH 016/144] t0300-credentials.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 017/144] t1000-read-tree-m-3way.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 018/144] t1001-read-tree-m-2way.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 019/144] t1002-read-tree-m-u-2way.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 020/144] t1003-read-tree-prefix.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 021/144] t1004-read-tree-m-u-wf.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 022/144] t1020-subdirectory.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 023/144] t1050-large.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 024/144] t1100-commit-tree-options.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 025/144] t1401-symbolic-ref.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 026/144] t1410-reflog.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 027/144] t1511-rev-parse-caret.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 028/144] t1512-rev-parse-disambiguation.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 029/144] t2102-update-index-symlinks.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 030/144] t3030-merge-recursive.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 031/144] t3100-ls-tree-restrict.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 032/144] t3101-ls-tree-dirname.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 033/144] t3210-pack-refs.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 034/144] t3403-rebase-skip.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 035/144] t3511-cherry-pick-x.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 036/144] t3600-rm.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 037/144] t3700-add.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 038/144] t3905-stash-include-untracked.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 039/144] t3910-mac-os-precompose.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 040/144] t4006-diff-mode.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 041/144] t4010-diff-pathspec.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 042/144] t4012-diff-binary.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 043/144] t4013-diff-various.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 044/144] t4014-format-patch.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 045/144] t4036-format-patch-signer-mime.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 046/144] t4038-diff-combined.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 047/144] t4057-diff-combined-paths.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 048/144] t4116-apply-reverse.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 049/144] t4119-apply-config.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 050/144] t4204-patch-id.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 051/144] t5000-tar-tree.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 052/144] t5003-archive-zip.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 053/144] t5100-mailinfo.sh: " Elia Pinto
2014-03-25  8:24 ` [PATCH 054/144] t5300-pack-object.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 055/144] t5301-sliding-window.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 056/144] t5302-pack-index.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 057/144] t5303-pack-corruption-resilience.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 058/144] t5304-prune.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 059/144] t5305-include-tag.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 060/144] t5500-fetch-pack.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 061/144] t5505-remote.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 062/144] t5506-remote-groups.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 063/144] t5510-fetch.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 064/144] t5515-fetch-merge-logic.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 065/144] t5516-fetch-push.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 066/144] t5517-push-mirror.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 067/144] t5520-pull.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 068/144] t5522-pull-symlink.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 069/144] t5530-upload-pack-error.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 070/144] t5537-fetch-shallow.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 071/144] t5538-push-shallow.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 072/144] t5550-http-fetch-dumb.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 073/144] t5551-http-fetch-smart.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 074/144] t5570-git-daemon.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 075/144] t5601-clone.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 076/144] t5700-clone-reference.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 077/144] t5710-info-alternate.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 078/144] t5900-repo-selection.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 079/144] t6001-rev-list-graft.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 080/144] t6002-rev-list-bisect.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 081/144] t6015-rev-list-show-all-parents.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 082/144] t6032-merge-large-rename.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 083/144] t6034-merge-rename-nocruft.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 084/144] t6111-rev-list-treesame.sh: " Elia Pinto
2014-03-25  8:52   ` Matthieu Moy
2014-03-25  9:52     ` Elia Pinto
2014-03-25  8:25 ` [PATCH 085/144] t6132-pathspec-exclude.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 086/144] t7001-mv.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 087/144] t7003-filter-branch.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 088/144] t7004-tag.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 089/144] t7006-pager.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 090/144] t7103-reset-bare.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 091/144] t7406-submodule-update.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 092/144] t7408-submodule-reference.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 093/144] t7504-commit-msg-hook.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 094/144] t7505-prepare-commit-msg-hook.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 095/144] t7602-merge-octopus-many.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 096/144] t7700-repack.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 097/144] t8003-blame-corner-cases.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 098/144] t9001-send-email.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 099/144] t9101-git-svn-props.sh: " Elia Pinto
2014-03-29 23:50   ` Eric Wong
2014-03-25  8:25 ` [PATCH 100/144] t9104-git-svn-follow-parent.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 101/144] t9105-git-svn-commit-diff.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 102/144] t9107-git-svn-migrate.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 103/144] t9108-git-svn-glob.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 104/144] t9109-git-svn-multi-glob.sh: " Elia Pinto
2014-03-25  8:25 ` [PATCH 105/144] t9110-git-svn-use-svm-props.sh: " 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=1395735989-3396-3-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).