]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix removing trailing whitespaces 9372/head
authorDaniel Arndt <arndtd@ornl.gov>
Fri, 17 Jan 2020 16:31:04 +0000 (09:31 -0700)
committerDaniel Arndt <arndtd@ornl.gov>
Fri, 17 Jan 2020 16:33:10 +0000 (09:33 -0700)
contrib/utilities/indent_common.sh

index d9c82e72d91692c214500f03a9675dea14e15d30..8861f659c7fe8cc04e82f06281c68a9f02f9f7bc 100644 (file)
@@ -163,12 +163,16 @@ format_file()
 export -f format_file
 
 #
-# Remove trailing whitespace
+# Remove trailiing whitespace. Mac OSX requires an extension for a backup file
+# for in-place replacements. So we need to provide something before the regex.
+# Using '-e' avoids creating these files on GNU platforms at least.
+# For Mac OSX, we still need to delete the created file.
 #
 
 remove_trailing_whitespace()
 {
-  sed -i 's/\s\+$//g' $1
+  sed -i -e 's/\s\+$//g' "$1"
+  rm -f "$1-e"
 }
 export -f remove_trailing_whitespace
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.