From: Elia Pinto <gitter.spiros@gmail.com>
To: git@vger.kernel.org
Cc: Elia Pinto <gitter.spiros@gmail.com>
Subject: [PATCH v2 002/142] git-am.sh: use the $( ... ) construct for command substitution
Date: Tue, 25 Mar 2014 10:22:23 -0700 [thread overview]
Message-ID: <1395768283-31135-3-git-send-email-gitter.spiros@gmail.com> (raw)
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>
---
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
next prev parent reply other threads:[~2014-03-25 17:37 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 17:22 [PATCH v2 000/142] Use the $( ... ) construct for command substitution instead of using the back-quotes Elia Pinto
2014-03-25 17:22 ` [PATCH v2 001/142] check-builtins.sh: use the $( ... ) construct for command substitution Elia Pinto
2014-03-25 19:57 ` Junio C Hamano
2014-03-25 20:32 ` David Kastrup
2014-03-26 12:19 ` Matthieu Moy
2014-03-25 20:36 ` Junio C Hamano
2014-03-25 20:38 ` Junio C Hamano
2014-03-26 6:57 ` Matthieu Moy
2014-03-25 17:22 ` Elia Pinto [this message]
2014-03-25 17:22 ` [PATCH v2 003/142] git-pull.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 004/142] git-rebase--merge.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 005/142] git-rebase.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 006/142] git-stash.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 007/142] git-web--browse.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 008/142] unimplemented.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 009/142] t0001-init.sh: " Elia Pinto
2014-03-25 20:02 ` Junio C Hamano
2014-03-25 17:22 ` [PATCH v2 010/142] t0010-racy-git.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 011/142] t0020-crlf.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 012/142] t0025-crlf-auto.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 013/142] t0026-eol-config.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 014/142] t0030-stripspace.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 015/142] t0300-credentials.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 016/142] t1000-read-tree-m-3way.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 017/142] t1001-read-tree-m-2way.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 018/142] t1002-read-tree-m-u-2way.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 019/142] t1003-read-tree-prefix.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 020/142] t1004-read-tree-m-u-wf.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 021/142] t1020-subdirectory.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 022/142] t1050-large.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 023/142] t1100-commit-tree-options.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 024/142] t1401-symbolic-ref.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 025/142] t1410-reflog.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 026/142] t1511-rev-parse-caret.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 027/142] t1512-rev-parse-disambiguation.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 028/142] t2102-update-index-symlinks.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 029/142] t3030-merge-recursive.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 030/142] t3100-ls-tree-restrict.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 031/142] t3101-ls-tree-dirname.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 032/142] t3210-pack-refs.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 033/142] t3403-rebase-skip.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 034/142] t3511-cherry-pick-x.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 035/142] t3600-rm.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 036/142] t3700-add.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 037/142] t3905-stash-include-untracked.sh: " Elia Pinto
2014-03-25 17:22 ` [PATCH v2 038/142] t3910-mac-os-precompose.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 039/142] t4006-diff-mode.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 040/142] t4010-diff-pathspec.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 041/142] t4012-diff-binary.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 042/142] t4013-diff-various.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 043/142] t4014-format-patch.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 044/142] t4036-format-patch-signer-mime.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 045/142] t4038-diff-combined.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 046/142] t4057-diff-combined-paths.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 047/142] t4116-apply-reverse.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 048/142] t4119-apply-config.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 049/142] t4204-patch-id.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 050/142] t5000-tar-tree.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 051/142] t5003-archive-zip.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 052/142] t5100-mailinfo.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 053/142] t5300-pack-object.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 054/142] t5301-sliding-window.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 055/142] t5302-pack-index.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 056/142] t5303-pack-corruption-resilience.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 057/142] t5304-prune.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 058/142] t5305-include-tag.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 059/142] t5500-fetch-pack.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 060/142] t5505-remote.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 061/142] t5506-remote-groups.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 062/142] t5510-fetch.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 063/142] t5515-fetch-merge-logic.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 064/142] t5516-fetch-push.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 065/142] t5517-push-mirror.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 066/142] t5520-pull.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 067/142] t5522-pull-symlink.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 068/142] t5530-upload-pack-error.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 069/142] t5537-fetch-shallow.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 070/142] t5538-push-shallow.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 071/142] t5550-http-fetch-dumb.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 072/142] t5551-http-fetch-smart.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 073/142] t5570-git-daemon.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 074/142] t5601-clone.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 075/142] t5700-clone-reference.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 076/142] t5710-info-alternate.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 077/142] t5900-repo-selection.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 078/142] t6001-rev-list-graft.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 079/142] t6002-rev-list-bisect.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 080/142] t6015-rev-list-show-all-parents.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 081/142] t6032-merge-large-rename.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 082/142] t6034-merge-rename-nocruft.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 083/142] t6132-pathspec-exclude.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 084/142] t7001-mv.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 085/142] t7003-filter-branch.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 086/142] t7004-tag.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 087/142] t7006-pager.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 088/142] t7103-reset-bare.sh: " Elia Pinto
2014-03-25 17:23 ` [PATCH v2 089/142] t7406-submodule-update.sh: " Elia Pinto
2014-03-25 18:41 ` [PATCH v2 000/142] Use the $( ... ) construct for command substitution instead of using the back-quotes Junio C Hamano
2014-03-26 7:02 ` Matthieu Moy
2014-03-26 7:44 ` Eric Sunshine
2014-03-26 9:41 ` 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=1395768283-31135-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).