commit: b86673c79105fa3cfd5ec84e6d1e052587f9f96b
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 02:00:31 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue May 24 02:00:31 2016 +0000
URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=b86673c7
catalyst-auto: convert `echo -e` to `printf`
Makes the code a bit more robust.
tools/catalyst-auto | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/catalyst-auto b/tools/catalyst-auto
index beb7aa8..de1b10d 100755
--- a/tools/catalyst-auto
+++ b/tools/catalyst-auto
@@ -61,12 +61,14 @@ send_email() {
logfile=$3
if [ -n "${logfile}" ]; then
- body=$(echo -e "${message}\n\n"; tail -n 200 "${logfile}"; echo -e
"\n\n\nFull build log at ${logfile}")
+ body=$(printf '%b\n\n\n' "${message}"; tail -n 200 "${logfile}"; printf
'\n\n\nFull build log at %s\n' "${logfile}")
else
body=${message}
fi
- echo -e "From: ${EMAIL_FROM}\r\nTo: ${EMAIL_TO}\r\nSubject:
${subject}\r\n\r\n${body}" | /usr/sbin/sendmail -f ${EMAIL_FROM} ${EMAIL_TO//,/
}
+ printf 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%b' \
+ "${EMAIL_FROM}" "${EMAIL_TO}" "${subject}" "${body}" | \
+ /usr/sbin/sendmail -f "${EMAIL_FROM}" ${EMAIL_TO//,/ }
}
run_cmd() {