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

[PATCH] t3419-*.sh: Fix arithmetic expansion syntax error

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 21, 2010, 18:50 UTC
Message-ID
<4D10F707.1000206@ramsay1.demon.co.uk>

Some shells, for example dash versions older than 0.5.4, need to spell a variable reference as '$N' rather than 'N' in an arithmetic expansion. In order to avoid the syntax error, we change the offending variable reference from 'i' to '$i' in function scramble.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Note that this test is unique in having an '#!/bin/bash' line (rather than '#!/bin/sh'), which was (indirectly) responsible for me not noticing this failure for a while. I don't see anything that would require bash, so I suspect this is not intensional.

ATB, Ramsay Jones

 t/t3419-rebase-patch-id.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh
index 1aee483..6972b49 100755
--- a/t/t3419-rebase-patch-id.sh
+++ b/t/t3419-rebase-patch-id.sh
@@ -27,7 +27,7 @@ scramble()
 		then
 			echo "$x"
 		fi
-		i=$(((i+1) % 10))
+		i=$((($i+1) % 10))
 	done < "$1" > "$1.new"
 	mv -f "$1.new" "$1"
 }
-- 
1.7.3
Next: Junio C Hamano
Message 1 of 3 in “t3419-*.sh: Fix arithmetic expansion syntax error”
  1. t3419-*.sh: Fix arithmetic expansion syntax errorRamsay Jones, Dec 21, 2010
  2. Junio C HamanoDec 21, 2010
  3. Clemens BuchacherDec 22, 2010

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.