From 807197d92af71a77d9505f86f1f3b3da0062f6b2 Mon Sep 17 00:00:00 2001
From: Michael <m.langguth@fz-juelich.de>
Date: Fri, 12 Feb 2021 13:47:37 +0100
Subject: [PATCH] Leave template runscript untouced when using
 setup_runscript_templates.sh.

---
 .../config_runscripts/setup_runscript_templates.sh    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/video_prediction_tools/config_runscripts/setup_runscript_templates.sh b/video_prediction_tools/config_runscripts/setup_runscript_templates.sh
index 4df60eb8..f99fda89 100644
--- a/video_prediction_tools/config_runscripts/setup_runscript_templates.sh
+++ b/video_prediction_tools/config_runscripts/setup_runscript_templates.sh
@@ -20,6 +20,7 @@ base_data_dir_default=/p/project/deepacf/deeprain/video_prediction_shared_folder
 CURR_DIR_FULL=`pwd`
 CURR_DIR="$(basename "$CURR_DIR_FULL")"
 BASE_DIR="$(dirname "$CURR_DIR_FULL")"
+USER=$USER
 
 ### Some sanity checks ###
 # ensure that the script is executed from the env_setup-subdirectory
@@ -51,14 +52,16 @@ fi
 
 echo "Start setting up templates under nonHPC_scripts/..."
 for f in ${BASE_DIR}/nonHPC_scripts/*template.sh; do
-  echo ${f}
-  sed -i "s|\(.*_dir=\).*|\1${data_dir}|g" ${f}
+  fnew=${f%%.*}_${USER}.sh
+  cp ${f} ${fnew}
+  sed -i "s|\(.*_dir=\).*|\1${data_dir}|g" ${fnew}
 done
 echo "Done!"
 
 echo "Start setting up templates under HPC_scripts/"
 for f in ${BASE_DIR}/HPC_scripts/*template.sh; do
-  echo ${f}
-  sed -i "s|\(.*_dir=\).*|\1${data_dir}|g" ${f}
+  fnew=${f%%.*}_${USER}.sh
+  cp ${f} ${fnew}
+  sed -i "s|\(.*_dir=\).*|\1${data_dir}|g" ${fnew}
 done
 # end
-- 
GitLab