Skip to contentSkip to conversation

git-quiltimport /bin/sh-ism fix

PATCH In review Francis Daly 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-quiltimport /bin/sh-ism fix

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.

---
 git-quiltimport.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-quiltimport.sh +1 -1
index 08ac9bb..edccd82 100755
@@ -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
Signature · 1 line
1.5.1.rc3-dirty
#1 lore raw
Quoted 19 lines · Francis Daly

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.

---
 git-quiltimport.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-quiltimport.sh +0 -0
index 08ac9bb..edccd82 100755

git-quiltimport.sh for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do · line 121

Quoted 8 lines
git-quiltimport.sh +1 -1
@@ -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

#2 lore raw
In reply to Francis Daly
Quoted 8 lines · Francis Daly

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.