[PATCH 15/15] t4032-diff-inter-hunk-context.sh: replace using expr for arithmetic operations with the equivalent shell builtin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



expr is considered generally antiquated. It is best to use for arithmetic operations
the shell $((..)).

To quote POSIX:

    "The expr utility has a rather difficult syntax [...] In many cases, the arithmetic
    and string features provided as part of the shell command language are easier to use
    than their equivalents in expr. Newly written scripts should avoid expr in favor of
    the new features within the shell."

Signed-off-by: Elia Pinto <gitter.spiros@xxxxxxxxx>
---
 t/t4032-diff-inter-hunk-context.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t4032-diff-inter-hunk-context.sh b/t/t4032-diff-inter-hunk-context.sh
index e4e3e28..0b0b60f 100755
--- a/t/t4032-diff-inter-hunk-context.sh
+++ b/t/t4032-diff-inter-hunk-context.sh
@@ -10,7 +10,7 @@ f() {
 	while test $i -le $2
 	do
 		echo $i
-		i=$(expr $i + 1)
+		i=$(( $i + 1 ))
 	done
 	echo $3
 }
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]