[PATCH v2] thunderbird-patch-inline: avoid bashism
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Feb 10, 2025, 23:49 UTC
- Message-ID
- <20250210234947.1317056-1-sandals@crustytoothpaste.net>
- In-Reply-To
- <20250204014652.3509928-1-sandals@crustytoothpaste.net>
The use of "echo -e" is not portable and not specified by POSIX. dash does not support any options except "-n", and so this script will not work on operating systems which use that as /bin/sh.
Fortunately, the solution is easy: switch to printf(1), which is specified by POSIX and allows the escape sequences we want to use. This will allow the script to work with any POSIX shell.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> --- contrib/thunderbird-patch-inline/appp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Changes from v1: * Add a missing newline.
I'll note that I could have just written '%s\n' here, but I think this is a little easier to reason about, so I didn't.
diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh index 1053872eea..fdcc948352 100755 --- a/contrib/thunderbird-patch-inline/appp.sh +++ b/contrib/thunderbird-patch-inline/appp.sh @@ -31,7 +31,7 @@ BODY=$(sed -e "1,/${SEP}/d" $1) CMT_MSG=$(sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}") DIFF=$(sed -e '1,/^---$/d' "${PATCH}") -CCS=$(echo -e "$CMT_MSG\n$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \ +CCS=$(printf '%s\n%s\n' "$CMT_MSG" "$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \ -e 's/^Signed-off-by: \(.*\)/\1,/gp') echo "$SUBJECT" > $1