From 65356cb4dce4b703635b4ec2cd8f8a59ccfbd20f Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Mon, 18 May 2020 08:56:24 +0000
Subject: [PATCH] Swapped if for ternaries inline

---
 backup.sh |   29 +++++++++--------------------
 1 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/backup.sh b/backup.sh
index 546a867..4898c7a 100755
--- a/backup.sh
+++ b/backup.sh
@@ -6,25 +6,14 @@
 RCLONE_FILES=("sout" "Mega" "unimelb")
 
 function sync() {
-	if [ $2 != "p" ]; then
-		case $1 in
-			"sout")
-				rclone sync $BACKUP_DIR $1:/data/Cloud/backup $(! [ -z $3 ] && echo "-P")
-				;;
-			*)
-				rclone sync $BACKUP_DIR $1:/Uni/duplicacy  $(! [ -z $3 ] && echo "-P")
-				;;
-		esac
-	else
-		case $1 in
-			"sout")
-				rclone sync $FILES_DIR $1:/data/Cloud/files  $(! [ -z $3 ] && echo "-P")
-				;;
-			*)
-				rclone sync $FILES_DIR $1:/Uni/files  $(! [ -z $3 ] && echo "-P")
-				;;
-			esac
-	fi
+	case $1 in
+		"sout")
+			rclone sync $([ $2 != "p" ] && echo "$BACKUP_DIR" || echo "$FILES_DIR") $1:/data/Cloud/$([ $2 != "p" ] && echo "backup" || echo "files") $(! [ -z $3 ] && echo "-P")
+			;;
+		*)
+			rclone sync $([ $2 != "p" ] && echo "$BACKUP_DIR" || echo "$FILES_DIR") $1:/Uni/$([ $2 != "p" ] && echo "duplicacy" || echo "files")  $(! [ -z $3 ] && echo "-P")
+			;;
+	esac
 }
 
 function sync_all() {
@@ -41,7 +30,7 @@
 			sync $i n p
 		done
 		for i in ${RCLONE_FILES[*]}; do
-			echo '\033[0;31m'$i files'\033[0m'
+			echo -e '\033[0;31m'$i files'\033[0m'
 			sync $i p p
 		done
 	fi

--
Gitblit v1.9.3