t0030-stripspace.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 sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elia Pinto committed
Apr 28, 2014 at 05:57 UTC
4d713567f9e79f738e7b309ad0222e1517871f9c
1 file changed
+10
-10
t/t0030-stripspace.sh
+10
-10
@@ -225,22 +225,22 @@ test_expect_success \
225
226
test_expect_success \
227
'text without newline at end should end with newline' '
228
- test `printf "$ttt" | git stripspace | wc -l` -gt 0 &&
229
- test `printf "$ttt$ttt" | git stripspace | wc -l` -gt 0 &&
230
- test `printf "$ttt$ttt$ttt" | git stripspace | wc -l` -gt 0 &&
231
- test `printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l` -gt 0
228
+ test $(printf "$ttt" | git stripspace | wc -l) -gt 0 &&
229
+ test $(printf "$ttt$ttt" | git stripspace | wc -l) -gt 0 &&
230
+ test $(printf "$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 &&
231
+ test $(printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0
232
'
233
234
# text plus spaces at the end:
235
236
test_expect_success \
237
'text plus spaces without newline at end should end with newline' '
238
- test `printf "$ttt$sss" | git stripspace | wc -l` -gt 0 &&
239
- test `printf "$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 &&
240
- test `printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 &&
241
- test `printf "$ttt$sss$sss" | git stripspace | wc -l` -gt 0 &&
242
- test `printf "$ttt$ttt$sss$sss" | git stripspace | wc -l` -gt 0 &&
243
- test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0
238
+ test $(printf "$ttt$sss" | git stripspace | wc -l) -gt 0 &&
239
+ test $(printf "$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 &&
240
+ test $(printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 &&
241
+ test $(printf "$ttt$sss$sss" | git stripspace | wc -l) -gt 0 &&
242
+ test $(printf "$ttt$ttt$sss$sss" | git stripspace | wc -l) -gt 0 &&
243
+ test $(printf "$ttt$sss$sss$sss" | git stripspace | wc -l) -gt 0
244
'
245
246
test_expect_success \