Index: trunk/libIGCM/AA_clean_or_continue
===================================================================
--- trunk/libIGCM/AA_clean_or_continue	(revision 1582)
+++ trunk/libIGCM/AA_clean_or_continue	(revision 1583)
@@ -37,10 +37,29 @@
 echo ""
 echo "clean_or_continue.job "
-if  [ $# -gt 0 ] ; then
+
+# Read arguments
+print_help=no
+force_rm=no
+while (($# > 0)) ; do
+  case $1 in
+    "-h")
+        print_help=yes ; shift ;;
+
+    "-f")
+        force_rm=yes ; shift ;;
+    *)
+        echo "Unknown option "$1" . Use -h for help."
+        exit
+   esac
+done
+
+
+if [ $print_help == yes ] ; then
     # Print help and exit
     echo ""
     echo "The script is called from in the your experiment directory, the so-called SUBMIT_DIR, in the following way"
-    echo "../../../libIGCM/clean_or_continue.job -h      : to print following information"
-    echo "../../../libIGCM/clean_or_continue.job         : normal execution"
+    echo "../../../libIGCM/clean_or_continue.job         : normal execution, you'll be asked before files are deleted"
+    echo "../../../libIGCM/clean_or_continue.job -f      : force normal execution to delete files without asking"
+    echo "../../../libIGCM/clean_or_continue.job -h      : print following information"
     echo ""
     echo "This script can be used for 3 cases:"
@@ -62,8 +81,14 @@
     exit
 fi
-echo ""
-echo "This script needs to delete files to work correctly. Therefore you should answer yes to the questions."
-echo "Use ../../../libIGCM/clean_or_contine.job -h  for more information"
-echo ""
+
+if [ $force_rm == yes ] ; then
+  echo ""
+  echo "Option -f to delete files without asking is set"
+else
+  echo ""
+  echo "This script needs to delete files to work correctly. Therefore you should answer yes to the questions."
+  echo "Use ../../../libIGCM/clean_or_contine.job -h  for more information"
+  echo ""
+fi
 
 #D--------------------------------------------------------------------==
@@ -124,11 +149,16 @@
   # 
   if [ X${run_Configuration_CumulPeriod} = X ] ; then
-    echo -e "\033[1;32mCumulPeriod is empty so we want to erase run.card to start properly. Do you want that?"
-    echo -n -e " Your answer (y/n) : \033[m"
-    read reponse
+    if [ $force_rm == yes ] ; then
+	echo -e "\033[1;32mCumulPeriod is empty so run.card will be deleted to start properly. "
+	reponse=yes
+    else
+	echo -e "\033[1;32mCumulPeriod is empty so we want to erase run.card to start properly. Do you want that?"
+	echo -n -e " Your answer (y/n) : \033[m"
+	read reponse
+    fi
     case ${reponse} in
 
     oui|OUI|o|y|yes|YES)
-      echo "OK. Now you can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}."
+      echo "Now you can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}"
       IGCM_sys_Rm ${SUBMIT_DIR}/run.card
       ;;
@@ -171,11 +201,15 @@
       done
     fi
-    echo -e "\033[1;32mDo you REALLY want to erase all those files ?"
-    echo -n -e " Your answer (y/n) : \033[m"
-    read reponse
-    case ${reponse} in
-
-      oui|OUI|o|y|yes|YES)
-        echo "OK. It will be erased."
+    if [ $force_rm == yes ] ; then
+	reponse=y
+    else
+	echo -e "\033[1;32mDo you REALLY want to erase all those files ?"
+	echo -n -e " Your answer (y/n) : \033[m"
+	read reponse
+    fi
+    case ${reponse} in
+
+      oui|OUI|o|y|yes|YES)
+        echo "The files will be erased."
         IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;"
         if [ X${Pack} = Xtrue ] ; then
@@ -196,11 +230,15 @@
     done
 
-    echo -e "\033[1;32mDo you REALLY want to erase all those Directories ?"
-    echo -n -e " Your answer (y/n) : \033[m"
-    read reponse
-    case ${reponse} in
-
-      oui|OUI|o|y|yes|YES)
-        echo "OK. It will be erased."
+    if [ $force_rm == yes ] ; then
+	reponse=y
+    else
+	echo -e "\033[1;32mDo you REALLY want to erase all those Directories ?"
+	echo -n -e " Your answer (y/n) : \033[m"
+	read reponse
+    fi
+    case ${reponse} in
+
+      oui|OUI|o|y|yes|YES)
+        echo "The files will be erased."
         find ${REBUILD_DIR} -type d -name "*${PeriodDateBegin}*" -exec rm -Rf '{}' \;
         echo "done."
@@ -215,11 +253,16 @@
   if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
 
-    echo -e "\033[1;32mNOW do you want to continue the simulation (Set PeriodState=OnQueue into run.card) ?"
-    echo -n -e " Your answer (y/n) : \033[m"
-    read reponse
-    case ${reponse} in
-
-      oui|OUI|o|y|yes|YES)
-        echo "OK. Now you can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}."
+    if [ $force_rm == yes ] ; then
+	echo -e "\033[1;32mPeriodState=OnQueue is set in run.card)"
+	reponse=y
+    else
+	echo -e "\033[1;32mNOW do you want to continue the simulation (Set PeriodState=OnQueue into run.card) ?"
+	echo -n -e " Your answer (y/n) : \033[m"
+	read reponse
+    fi
+    case ${reponse} in
+
+      oui|OUI|o|y|yes|YES)
+        echo "You can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}"
         IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue"
         ;;
@@ -229,15 +272,20 @@
     esac
   else
-    echo "You can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}."
+    echo "You can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}"
   fi
 
   if [ X${run_Configuration_CumulPeriod} = X1 ] ; then
-    echo -e "\033[1;32mCumulPeriod=1 so we want to erase run.card to start properly. Do you want that too?"
-    echo -n -e " Your answer (y/n) : \033[m"
-    read reponse
-    case ${reponse} in
-
-      oui|OUI|o|y|yes|YES)
-        echo "OK. Now you can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}."
+    if [ $force_rm == yes ] ; then
+	echo -e "\033[1;32mCumulPeriod=1 and therfor run.card is deleted to start properly."
+	reponse=y
+    else
+	echo -e "\033[1;32mCumulPeriod=1 so we want to erase run.card to start properly. Do you want that too?"
+	echo -n -e " Your answer (y/n) : \033[m"
+	read reponse
+    fi
+    case ${reponse} in
+
+      oui|OUI|o|y|yes|YES)
+        echo "You can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}"
         IGCM_sys_Rm ${SUBMIT_DIR}/run.card
         ;;
@@ -252,7 +300,12 @@
     Script_Output=${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${run_Configuration_CumulPeriod} )
 
-    echo -e "\033[1;32mDo you want to change the number in Script_Output? (${Script_Output} into Job) ?"
-    echo -n -e " Your answer (y/n) : \033[m"
-    read reponse
+    if [ $force_rm == yes ] ; then
+	echo -e "\033[1;32mThe number in the jobname in Script_Output is changed."
+	reponse=y
+    else
+	echo -e "\033[1;32mDo you want to change the number in Script_Output? (${Script_Output} into Job) ?"
+	echo -n -e " Your answer (y/n) : \033[m"
+	read reponse
+    fi
     case ${reponse} in
 
