* [PATCH] t7800: avoid arithmetic expansion notation
@ 2011-10-14 12:15 Michael J Gruber
2011-10-14 18:00 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Michael J Gruber @ 2011-10-14 12:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Sitaram Chamarty
ba959de (git-difftool: allow skipping file by typing 'n' at prompt, 2011-10-08)
introduced shell code like
$((foo; bar) | baz)
which some shells (e.g. bash, dash) interpret as an unfinished arithmetic
evaluation $(( expr )).
Write this as
$({foo; bar; } | baz)
which is unambiguous and also avoids an unnecessary subshell.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
t/t7800-difftool.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 7fc2b3a..76a8b70 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -289,7 +289,7 @@ test_expect_success PERL 'setup with 2 files different' '
'
test_expect_success PERL 'say no to the first file' '
- diff=$((echo n; echo) | git difftool -x cat branch) &&
+ diff=$({ echo n; echo; } | git difftool -x cat branch) &&
echo "$diff" | stdin_contains m2 &&
echo "$diff" | stdin_contains br2 &&
@@ -298,7 +298,7 @@ test_expect_success PERL 'say no to the first file' '
'
test_expect_success PERL 'say no to the second file' '
- diff=$((echo; echo n) | git difftool -x cat branch) &&
+ diff=$({ echo; echo n; } | git difftool -x cat branch) &&
echo "$diff" | stdin_contains master &&
echo "$diff" | stdin_contains branch &&
--
1.7.7.338.g0156b
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] t7800: avoid arithmetic expansion notation
2011-10-14 12:15 [PATCH] t7800: avoid arithmetic expansion notation Michael J Gruber
@ 2011-10-14 18:00 ` Junio C Hamano
2011-10-14 19:00 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2011-10-14 18:00 UTC (permalink / raw)
To: Michael J Gruber; +Cc: git, Sitaram Chamarty
Michael J Gruber <git@drmicha.warpmail.net> writes:
> ba959de (git-difftool: allow skipping file by typing 'n' at prompt, 2011-10-08)
> introduced shell code like
>
> $((foo; bar) | baz)
>
> which some shells (e.g. bash, dash) interpret as an unfinished arithmetic
> evaluation $(( expr )).
Ahh, thanks, I should have caught this. I recall I rewrote a similar one
to $( (command; command) | command ) more than once before.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] t7800: avoid arithmetic expansion notation
2011-10-14 18:00 ` Junio C Hamano
@ 2011-10-14 19:00 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2011-10-14 19:00 UTC (permalink / raw)
To: Michael J Gruber; +Cc: git, Sitaram Chamarty
Junio C Hamano <gitster@pobox.com> writes:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> ba959de (git-difftool: allow skipping file by typing 'n' at prompt, 2011-10-08)
>> introduced shell code like
>>
>> $((foo; bar) | baz)
>>
>> which some shells (e.g. bash, dash) interpret as an unfinished arithmetic
>> evaluation $(( expr )).
>
> Ahh, thanks, I should have caught this. I recall I rewrote a similar one
> to $( (command; command) | command ) more than once before.
Forgot to mention that I love to see the issues on topics discovered and
corrected before they are still cooking in 'next', like this ;-)
Thanks all.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-14 19:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-14 12:15 [PATCH] t7800: avoid arithmetic expansion notation Michael J Gruber
2011-10-14 18:00 ` Junio C Hamano
2011-10-14 19:00 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox