From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elia Pinto Subject: [PATCH 09/10] test-sha1.sh: use the $( ... ) construct for command substitution Date: Tue, 22 Dec 2015 15:10:31 +0100 Message-ID: <1450793432-9345-10-git-send-email-gitter.spiros@gmail.com> References: <1450793432-9345-1-git-send-email-gitter.spiros@gmail.com> Cc: Elia Pinto To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Tue Dec 22 15:10:59 2015 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 1aBNeU-0002jz-Tr for gcvg-git-2@plane.gmane.org; Tue, 22 Dec 2015 15:10:59 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754227AbbLVOK4 (ORCPT ); Tue, 22 Dec 2015 09:10:56 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:36579 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752164AbbLVOKs (ORCPT ); Tue, 22 Dec 2015 09:10:48 -0500 Received: by mail-pa0-f45.google.com with SMTP id q3so97269651pav.3 for ; Tue, 22 Dec 2015 06:10:48 -0800 (PST) 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=0+bBLDkuOTnTiw7SacVg0gpjuu43E5jVLygHvG1TAIM=; b=WGCIQByEdQqrBUYkkDIGdlgro2rlKLlD8Y48cb+MCNP5bkH2GeMALvkMyk1aX1wWQp R62n9XWLvRMqnfOXlRP7LqsJgaxpJjpDSaU2fwbrb442lnIvMVZjzHcCTuLQeVdx4MaP O2x/Iv1SYUrBx2uIcwaNvMes6eay4LozvMqffCgCsb9xPpwdKOyHUlWiBeqpypslrU42 dInd7yKr+2DIh+83b4CeO28lhYsZkjcM+Ry+CEAza1E0bm+wo14jVVxV41iWMt/xohjo lo96sAAJN/egWK2khIA2XSy9XjRiwDUF529BnYbAC/UEcCvHh77pkBs/Ek2TnZH5qrXv rTeg== X-Received: by 10.66.251.226 with SMTP id zn2mr35976790pac.44.1450793448027; Tue, 22 Dec 2015 06:10:48 -0800 (PST) Received: from ubuntu14.nephoscale.com (static-67.207.195.141.nephosdns.com. [67.207.195.141]) by smtp.gmail.com with ESMTPSA id fe6sm46421455pab.40.2015.12.22.06.10.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Dec 2015 06:10:47 -0800 (PST) X-Mailer: git-send-email 2.3.3.GIT In-Reply-To: <1450793432-9345-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 perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}" done and then carefully proof-read. Signed-off-by: Elia Pinto --- test-sha1.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test-sha1.sh b/test-sha1.sh index 0f0bc5d..cef4bcc 100755 --- a/test-sha1.sh +++ b/test-sha1.sh @@ -6,13 +6,13 @@ dd if=/dev/zero bs=1048576 count=100 2>/dev/null | while read expect cnt pfx do case "$expect" in '#'*) continue ;; esac - actual=` + actual=$( { test -z "$pfx" || echo "$pfx" dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null | perl -pe 'y/\000/g/' } | ./test-sha1 $cnt - ` + ) if test "$expect" = "$actual" then echo "OK: $expect $cnt $pfx" @@ -51,14 +51,14 @@ exit while read cnt pfx do - actual=` + actual=$( { test -z "$pfx" || echo "$pfx" dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null | perl -pe 'y/\000/g/' } | sha1sum | sed -e 's/ .*//' - ` + ) echo "$actual $cnt $pfx" done <