Index: /trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 295)
+++ /trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 296)
@@ -845,5 +845,11 @@
 			j4=${j}
 			eval IGCM_sys_Put_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
-			[ ! ${file_in} = ${file_outin} ] && IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc
+			if [ ! ${file_in} = ${file_outin} ] ; then
+			    if ( ${ExitFlag} ) ; then
+				echo "IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc not executed."
+			    else
+				IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc
+			    fi
+			fi
 			#eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_in}_${j4}.nc" > /dev/null 2>&1
 			(( j=j+1 ))
@@ -851,5 +857,11 @@
 		else
 		    eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
-		    [ ! ${file_in} = ${file_outin} ] && IGCM_sys_Mv ${file_in} ${file_outin}
+		    if [ ! ${file_in} = ${file_outin} ] ; then
+			if ( ${ExitFlag} ) ; then
+			    echo "IGCM_sys_Mv ${file_in} ${file_outin} not executed."
+			else
+			    IGCM_sys_Mv ${file_in} ${file_outin}
+			fi
+		    fi
 		    #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
 		fi
@@ -904,17 +916,17 @@
 			if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
 			    if [ $DRYRUN -le 1 ]; then
-			    echo \#!/bin/ksh                                           > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo function IGCM_FlushRebuild                           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo {                                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo IGCM_debug_PushStack "IGCM_FlushRebuild"             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo echo                                                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo IGCM_debug_Print 1 "IGCM_FlushRebuild"               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo echo                                                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "\#!/bin/ksh                                          " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_PushStack "IGCM_FlushRebuild"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Print 1 "IGCM_FlushRebuild"              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 			    fi
 			fi
 			# Prepare the shell dedicated to offline rebuild
 			if [ $DRYRUN -le 1 ]; then
-			    echo IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo IGCM_debug_Verif_Exit                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Verif_Exit                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 			fi
 			#
@@ -923,6 +935,6 @@
 			    if [ X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) !=  X${NULL_STR} ]; then
 				for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
-				    echo . ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo IGCM_${Patch} ${file_in}                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "IGCM_${Patch} ${file_in}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 				done
 			    fi
@@ -930,7 +942,7 @@
 			#
 			if [ $DRYRUN -le 1 ]; then
-			    echo IGCM_sys_Put_Out ${file_in} ${file_out}                  >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo IGCM_debug_Verif_Exit                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo IGCM_sys_Rm ${generic_file_name}_*.nc                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_sys_Put_Out ${file_in} ${file_out}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Verif_Exit                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_sys_Rm ${generic_file_name}_*.nc                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 			fi
 			SaveOnArchive=false
@@ -949,10 +961,10 @@
 			    if [ $DRYRUN -le 1 ]; then
 				for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
-				    echo . ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo IGCM_${Patch} ${file_in}                             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "IGCM_${Patch} ${file_in}                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 				done
 			        #
-				echo IGCM_sys_Put_Out ${file_in} ${file_out}                  >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				echo IGCM_debug_Verif_Exit                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				echo "IGCM_sys_Put_Out ${file_in} ${file_out}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				echo "IGCM_debug_Verif_Exit                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 		                #
 			    fi
