From: Lei Qiao Date: Tue, 23 Feb 2021 03:34:07 +0000 (+0800) Subject: make remove_trailing_whitespace() works in both MAC OS and Linux system X-Git-Tag: v9.3.0-rc1~422^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b283ce78b5287f502b3204c51f8ec69be54c79db;p=dealii.git make remove_trailing_whitespace() works in both MAC OS and Linux system --- diff --git a/contrib/utilities/indent_common.sh b/contrib/utilities/indent_common.sh index 52071b0bac..bddad8366a 100644 --- a/contrib/utilities/indent_common.sh +++ b/contrib/utilities/indent_common.sh @@ -171,7 +171,11 @@ remove_trailing_whitespace() file="${1}" tmpfile="$(mktemp "${TMPDIR}/$(basename "$1").tmp.XXXXXXXX")" - sed 's/\s\+$//g' "${file}" > "${tmpfile}" + # + # Mac OS uses BSD sed (other than GNU sed in Linux), + # so it doesn't recognize \s as 'spaces' or + as 'one or more'. + # + sed 's/[[:space:]]\{1,\}$//g' "${file}" > "${tmpfile}" if ! diff -q "${file}" "${tmpfile}" >/dev/null; then mv "${tmpfile}" "${file}" fi