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 006/14] git-fetch.sh: use the $( ... ) construct for command substitution
Date: Wed, 16 Apr 2014 10:29:50 -0700	[thread overview]
Message-ID: <1397669398-25410-6-git-send-email-gitter.spiros@gmail.com> (raw)
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/examples/git-fetch.sh |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/examples/git-fetch.sh b/contrib/examples/git-fetch.sh
index a314273..5540709 100755
--- a/contrib/examples/git-fetch.sh
+++ b/contrib/examples/git-fetch.sh
@@ -67,7 +67,7 @@ do
 		keep='-k -k'
 		;;
 	--depth=*)
-		shallow_depth="--depth=`expr "z$1" : 'z-[^=]*=\(.*\)'`"
+		shallow_depth="--depth=$(expr "z$1" : 'z-[^=]*=\(.*\)')"
 		;;
 	--depth)
 		shift
@@ -262,12 +262,12 @@ fetch_per_ref () {
       http://* | https://* | ftp://*)
 	  test -n "$shallow_depth" &&
 		die "shallow clone with http not supported"
-	  proto=`expr "$remote" : '\([^:]*\):'`
+	  proto=$(expr "$remote" : '\([^:]*\):')
 	  if [ -n "$GIT_SSL_NO_VERIFY" ]; then
 	      curl_extra_args="-k"
 	  fi
 	  if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
-		"`git config --bool http.noEPSV`" = true ]; then
+		"$(git config --bool http.noEPSV)" = true ]; then
 	      noepsv_opt="--disable-epsv"
 	  fi
 
-- 
1.7.10.4

  parent reply	other threads:[~2014-04-16 17:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16 17:29 [PATCH 001/14] howto-index.sh: use the $( ... ) construct for command substitution Elia Pinto
2014-04-16 17:29 ` [PATCH 002/14] install-webdoc.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 003/14] git-checkout.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 004/14] git-clone.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 005/14] git-commit.sh: " Elia Pinto
2014-04-16 17:29 ` Elia Pinto [this message]
2014-04-16 17:29 ` [PATCH 007/14] git-ls-remote.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 008/14] git-merge.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 009/14] git-repack.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 010/14] git-resolve.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 011/14] git-revert.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 012/14] git-tag.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 013/14] t9360-mw-to-git-clone.sh: " Elia Pinto
2014-04-16 17:29 ` [PATCH 014/14] t9362-mw-to-git-utf8.sh: " Elia Pinto
2014-04-17  9:00 ` [PATCH 001/14] howto-index.sh: " Matthieu Moy
2014-04-17 18:25   ` Junio C Hamano

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=1397669398-25410-6-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).