test-sha1.sh: use the $( ... ) construct for command substitution
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 <gitter.spiros@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elia Pinto committed
Dec 22, 2015 at 15:10 UTC
21c6f9875a01484875ff17ec472568e1aadceb8f
1 file changed
+4
-4
test-sha1.sh
+4
-4
@@ -6,13 +6,13 @@ dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
6
while read expect cnt pfx
7
do
8
case "$expect" in '#'*) continue ;; esac
9
- actual=`
9
+ actual=$(
10
{
11
test -z "$pfx" || echo "$pfx"
12
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
13
perl -pe 'y/\000/g/'
14
} | ./test-sha1 $cnt
15
- `
15
+ )
16
if test "$expect" = "$actual"
17
then
18
echo "OK: $expect $cnt $pfx"
@@ -51,14 +51,14 @@ exit
51
52
while read cnt pfx
53
do
54
- actual=`
54
+ actual=$(
55
{
56
test -z "$pfx" || echo "$pfx"
57
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
58
perl -pe 'y/\000/g/'
59
} | sha1sum |
60
sed -e 's/ .*//'
61
- `
61
+ )
62
echo "$actual $cnt $pfx"
63
done <<EOF
64
0