From ecdd20cf9de67ab17660507f485fed676565cd25 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Jun 2011 16:06:32 +0100 Subject: [PATCH] ENH: cylinder/Allrun: keep backup separate --- tutorials/basic/potentialFoam/cylinder/Allrun | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tutorials/basic/potentialFoam/cylinder/Allrun b/tutorials/basic/potentialFoam/cylinder/Allrun index bb35ba990c..b9695da975 100755 --- a/tutorials/basic/potentialFoam/cylinder/Allrun +++ b/tutorials/basic/potentialFoam/cylinder/Allrun @@ -12,24 +12,18 @@ application=`getApplication` MAIN_CONTROL_DICT=`foamEtcFile controlDict` if [ -f "$MAIN_CONTROL_DICT" ] then - echo "Modifying ${MAIN_CONTROL_DICT}" - if [ -e ${MAIN_CONTROL_DICT}.org ] - then - echo "File ${MAIN_CONTROL_DICT}.org already exists" - echo "Did Allrun fail in some way and then run again?" - exit 1 - fi + echo "Modifying ${MAIN_CONTROL_DICT} to enable allowSystemOperations" # Clean up on termination and on Ctrl-C - trap 'mv ${MAIN_CONTROL_DICT}.org ${MAIN_CONTROL_DICT} 2>/dev/null; exit 0' \ + trap 'mv ${MAIN_CONTROL_DICT}.$$ ${MAIN_CONTROL_DICT} 2>/dev/null; exit 0' \ EXIT TERM INT - cp ${MAIN_CONTROL_DICT} ${MAIN_CONTROL_DICT}.org + cp ${MAIN_CONTROL_DICT} ${MAIN_CONTROL_DICT}.$$ echo "Enabling allowSystemOperations in ${MAIN_CONTROL_DICT}." sed \ -e s/"\(allowSystemOperations[ \t]*\)\([0-9]\);"/"\1 1;"/g \ - ${MAIN_CONTROL_DICT}.org > ${MAIN_CONTROL_DICT} + ${MAIN_CONTROL_DICT}.$$ > ${MAIN_CONTROL_DICT} fi cp -r 0.org 0 > /dev/null 2>&1