git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t7800: avoid arithmetic expansion notation

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 14, 2011, 12:15 UTC
Message-ID
<837ad77348b459aa5f5f79e556dbeeeba41027e7.1318594392.git.git@drmicha.warpmail.net>

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
Next: Junio C Hamano
Message 1 of 3 in “t7800: avoid arithmetic expansion notation”
  1. t7800: avoid arithmetic expansion notationMichael J Gruber, Oct 14, 2011
  2. Junio C HamanoOct 14, 2011
  3. Junio C HamanoOct 14, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.