From aeaabb68e769ebc07a1f66b88752cab48921632b Mon Sep 17 00:00:00 2001
From: Ejner Fergo <efer@dtu.dk>
Date: Fri, 29 Nov 2019 13:42:09 +0100
Subject: [PATCH] check shell

---
 comp-backup.sh | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/comp-backup.sh b/comp-backup.sh
index d361fa8..41c38df 100755
--- a/comp-backup.sh
+++ b/comp-backup.sh
@@ -13,7 +13,7 @@
 
 # Main Variables
 SCRIPTNAME="comp-backup"
-VERSION=4
+VERSION=5
 LOGNAME="backup_logfile"
 TARGETNODE="userbackup1.compute.dtu.dk"
 HOST=$(hostname -s)
@@ -137,8 +137,16 @@ elif [ ! -d $BIN_DIR ]; then
 fi
 $(echo $PATH | grep -o $BIN_DIR &>/dev/null)
 if [ $? -ne 0 ]; then
-    echo -e "\nexport PATH=$PATH:$BIN_DIR" >> $H/.bash_profile
-    source $H/.bash_profile
+    if [ $SHELL == '/bin/bash' ]; then
+        echo -e "\nexport PATH=$PATH:$BIN_DIR" >> $H/.bash_profile
+        source $H/.bash_profile
+    elif [ $SHELL == '/bin/zsh' ]; then
+        echo -e "\nexport PATH=$PATH:$BIN_DIR" >> $H/.zprofile
+        source $H/.zprofile
+    else
+        echo -e "\nexport PATH=$PATH:$BIN_DIR" >> $H/.profile
+        source $H/.profile
+    fi
 fi
 if [ ! -d $CONF_DIR ]; then
     mkdir -p $CONF_DIR 
-- 
GitLab