From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elia Pinto Subject: [PATCH 02/14] test-gitmw-lib.sh: use the $( ... ) construct for command substitution Date: Wed, 23 Apr 2014 06:43:54 -0700 Message-ID: <1398260646-2660-2-git-send-email-gitter.spiros@gmail.com> References: <1398260646-2660-1-git-send-email-gitter.spiros@gmail.com> Cc: matthieu.moy@grenoble-inp.fr, Elia Pinto To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Wed Apr 23 15:50:17 2014 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WcxZ2-0005lm-1t for gcvg-git-2@plane.gmane.org; Wed, 23 Apr 2014 15:50:16 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752609AbaDWNuI (ORCPT ); Wed, 23 Apr 2014 09:50:08 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:49169 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757050AbaDWNoO (ORCPT ); Wed, 23 Apr 2014 09:44:14 -0400 Received: by mail-pb0-f46.google.com with SMTP id rq2so798501pbb.19 for ; Wed, 23 Apr 2014 06:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oxN9CoO9+rsUYycxZYvO9zyXaPWBHGt3UIi2oxc5FNc=; b=vC8NsVugYxKvCNd/xRXX+c75QHqOt1u+aPTl+Tn4lT7acDEZPPqX5KB9qof4x9xO1e 60xjJLWBr3g0lw3mdT7x5RH97Ey4VpT4pSQp2CrR6qn+i+schzBjxX7IpEYRfy+DLCj4 CcCSKv78umG6o+iHPHMeuU9wZajmHJUNDIi4OV7q+yuWnWFTNfFavwDNkdW2Z8h1S1RI 3c4kVKmQUh/wPuwW7yOawtCaezbbiF1JK+aQzmySFbKYwyD8cv+XtEFLybg9jpdxi3tE P466mPogrnBH2nTSWLYeIOpmnmfTsoPVOfjugWwWupTaAL0NTxhJqUou8vY7uanjoGGP hATA== X-Received: by 10.68.133.229 with SMTP id pf5mr25638795pbb.115.1398260653801; Wed, 23 Apr 2014 06:44:13 -0700 (PDT) Received: from devzero2000ubu.nephoscale.com (140.195.207.67.nephoscale.net. [67.207.195.140]) by mx.google.com with ESMTPSA id kt8sm5314475pab.7.2014.04.23.06.44.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 06:44:13 -0700 (PDT) X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398260646-2660-1-git-send-email-gitter.spiros@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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 --- contrib/mw-to-git/t/test-gitmw-lib.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/mw-to-git/t/test-gitmw-lib.sh b/contrib/mw-to-git/t/test-gitmw-lib.sh index 3372b2a..c783752 100755 --- a/contrib/mw-to-git/t/test-gitmw-lib.sh +++ b/contrib/mw-to-git/t/test-gitmw-lib.sh @@ -90,7 +90,7 @@ test_diff_directories () { # # Check that contains exactly files test_contains_N_files () { - if test `ls -- "$1" | wc -l` -ne "$2"; then + if test $(ls -- "$1" | wc -l) -ne "$2"; then echo "directory $1 should contain $2 files" echo "it contains these files:" ls "$1" @@ -341,10 +341,10 @@ wiki_install () { "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\ "$MW_FILENAME. "\ "Please fix your connection and launch the script again." - echo "$MW_FILENAME downloaded in `pwd`. "\ + echo "$MW_FILENAME downloaded in $(pwd). "\ "You can delete it later if you want." else - echo "Reusing existing $MW_FILENAME downloaded in `pwd`." + echo "Reusing existing $MW_FILENAME downloaded in $(pwd)." fi archive_abs_path=$(pwd)/$MW_FILENAME cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" || -- 1.7.10.4