# [PATCH] git-quiltimport /bin/sh-ism fix

3 messages from 2007-03-29 to 2007-03-30. Participants: Francis Daly, Junio C Hamano, Wu, Bryan.
Thread: https://gitlist.dev/t/7478

## Francis Daly, 2007-03-29 21:38

Subject: [PATCH] git-quiltimport /bin/sh-ism fix
Message-ID: <20070329213820.GY24561@craic.sysops.org>
URL: https://gitlist.dev/e/20070329213820.GY24561%40craic.sysops.org

```

Bryan Wu reported
/usr/local/bin/git-quiltimport: 114: Syntax error: Missing '))'

Most bourne-ish shells I have here accept
 x=$((echo x)|cat)
but all bourne-ish shells I have here accept
 x=$( (echo x)|cat)
because $(( might mean arithmetic expansion.

Signed-off-by: Francis Daly <francis@daoine.org>
---
 git-quiltimport.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-quiltimport.sh b/git-quiltimport.sh
index 08ac9bb..edccd82 100755
--- a/git-quiltimport.sh
+++ b/git-quiltimport.sh
@@ -115,7 +115,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
 	if [ -z "$dry_run" ] ; then
 		git-apply --index -C1 "$tmp_patch" &&
 		tree=$(git-write-tree) &&
-		commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
+		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
 		git-update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
 	fi
 done
-- 
1.5.1.rc3-dirty

```

## Junio C Hamano, 2007-03-29 23:06

Subject: Re: [PATCH] git-quiltimport /bin/sh-ism fix
Message-ID: <7vr6r71wh0.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vr6r71wh0.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070329213820.GY24561@craic.sysops.org>

```
Francis Daly <francis@daoine.org> writes:

> Bryan Wu reported
> /usr/local/bin/git-quiltimport: 114: Syntax error: Missing '))'
>
> Most bourne-ish shells I have here accept
>  x=$((echo x)|cat)
> but all bourne-ish shells I have here accept
>  x=$( (echo x)|cat)
> because $(( might mean arithmetic expansion.

Well spotted, thanks.


Sheesh, this is even warned in POSIX sh manpage.

```

## Wu, Bryan, 2007-03-30 02:05

Subject: Re: [PATCH] git-quiltimport /bin/sh-ism fix
Message-ID: <1175220304.15391.46.camel@roc-desktop>
URL: https://gitlist.dev/e/1175220304.15391.46.camel%40roc-desktop
In-Reply-To: <20070329213820.GY24561@craic.sysops.org>

```
On Thu, 2007-03-29 at 22:38 +0100, Francis Daly wrote:
> Bryan Wu reported
> /usr/local/bin/git-quiltimport: 114: Syntax error: Missing '))'
> 
> Most bourne-ish shells I have here accept
>  x=$((echo x)|cat)
> but all bourne-ish shells I have here accept
>  x=$( (echo x)|cat)
> because $(( might mean arithmetic expansion.
> 
> Signed-off-by: Francis Daly <francis@daoine.org>
> ---
>  git-quiltimport.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/git-quiltimport.sh b/git-quiltimport.sh
> index 08ac9bb..edccd82 100755
> --- a/git-quiltimport.sh
> +++ b/git-quiltimport.sh
> @@ -115,7 +115,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
>  	if [ -z "$dry_run" ] ; then
>  		git-apply --index -C1 "$tmp_patch" &&
>  		tree=$(git-write-tree) &&
> -		commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
> +		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
>  		git-update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
>  	fi
>  done

Cool. Thanks a lot.
-Bryan

```
