From: martin f. krafft Date: Fri, 26 Sep 2008 19:04:19 +0000 (+0200) Subject: tg-mail: do not use arrays, which are bashisms X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=commitdiff_plain;h=6423f07442eddd157516839e149d328b74adb2c1 tg-mail: do not use arrays, which are bashisms tg-mail uses shell arrays for the people array, which are not supported by POSIX. The script runs as /bin/sh, so it cannot assume non-POSIX features. This patch reimplements the array population with a POSIX-compliant approach. Signed-off-by: martin f. krafft --- diff --git a/tg-mail.sh b/tg-mail.sh index dd50004..7b8f7ff 100644 --- a/tg-mail.sh +++ b/tg-mail.sh @@ -46,14 +46,12 @@ from="$(echo "$header" | grep '^From:' | sed 's/From:\s*//')" to="$(echo "$header" | grep '^To:' | sed 's/To:\s*//')" -# XXX: I can't get quoting right without arrays -people=() -[ -n "$from" ] && people=("${people[@]}" --from "$from") +people= +[ -n "$from" ] && people="$people --from '$from'" # FIXME: there could be multimple To -[ -n "$to" ] && people=("${people[@]}" --to "$to") - +[ -n "$to" ] && people="$people --to '$to'" # NOTE: git-send-email handles cc itself -git send-email $send_email_args "${people[@]}" "$patchfile" +eval git send-email $send_email_args "$people" "$patchfile" rm "$patchfile"