From: Sören Tempel <soe...@soeren-tempel.net> The `(( expression ))` syntax is a Bash extension and not supported by POSIX shell [1]. However, the arithmetic expressions used by the gobuild() function can also be expressed using arithmetic POSIX expansions with `$(( expression ))` [2].
Contrary to the Bash extension, arithmetic expansion doesn't set the return value if the expression is non-zero but instead just prints the expression result. Hence, the expression also needs to be negated. Without this patch, match.sh does currently not work correctly if /bin/sh is not a symlink to Bash. [1]: https://www.gnu.org/software/bash/manual/bash.html#Conditional-Constructs [2]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04 Signed-off-by: Sören Tempel <soe...@soeren-tempel.net> --- libgo/match.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgo/match.sh b/libgo/match.sh index 7ed587ff794..9fbb498544c 100755 --- a/libgo/match.sh +++ b/libgo/match.sh @@ -111,7 +111,7 @@ gobuild() { if test "$goarch" != "386"; then line=$(echo "$line" | sed -e "s/\\(${wrap}\\)386\\(${wrap}\\)/\10\2/g") fi - (($line)) + return $((!(line))) } matched=