From 50926ed214001172ed733330f2c9f2e227368435 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Wed, 24 Nov 2010 21:47:45 +0100 Subject: [PATCH] Updated foamUpdateCaseFileHeader --- bin/foamUpdateCaseFileHeader | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/bin/foamUpdateCaseFileHeader b/bin/foamUpdateCaseFileHeader index f5d937bd0..ae46d70f0 100755 --- a/bin/foamUpdateCaseFileHeader +++ b/bin/foamUpdateCaseFileHeader @@ -52,12 +52,11 @@ USAGE exit 1 } - printHeader() { cat<
/dev/null 2>&1 + if [ ! -x "$caseFile" ] && (grep "^ *FoamFile" $caseFile >/dev/null 2>&1) then echo "Updating case file: $caseFile" sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp FORMAT=$(FoamFileAttribute format FoamFile.tmp) CLASS=$(FoamFileAttribute class FoamFile.tmp) + NOTE=$(FoamFileAttribute note FoamFile.tmp) + LOCATION=$(FoamFileAttribute location FoamFile.tmp) OBJECT=$(FoamFileAttribute object FoamFile.tmp) - # extract NOTE? - printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp - sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp + printHeader > FoamFile.tmp + sed '1,/}/d' $caseFile | sed '/./,/^$/!d' | sed 's/ *$//g' >> FoamFile.tmp + #sed '1,/}/d' $caseFile >> FoamFile.tmp # use cat to avoid removing/replace soft-links [ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile