From b5fd1196edb0ee68d1ce810347a00f0e48b4a915 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 22 Jul 2017 16:57:26 +0200 Subject: [PATCH] [fix] fixed when cannot mount ${DEV}2 --- clone/clone | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clone/clone b/clone/clone index 03a1565..c361ef2 100755 --- a/clone/clone +++ b/clone/clone @@ -51,7 +51,7 @@ step1(){ mounted_partitions=$( cat /proc/mounts | awk '{print $1}' | grep "$DEV" ); # if nothing found -> next step - test -z "$mounted_partitions" && echo "<<< done" && step2; + ls ${DEV}2 > /dev/null 2>&1 || $( echo "<<< done" && step2 ); for mounted in $mounted_partitions; do @@ -137,6 +137,8 @@ step3(){ step4(){ echo -e "\n>>> [4] Mounting partition ${DEV}2"; + test ! -f ${DEV}2 && $( echo "<<< error: device ${DEV}2 does not exist" && exit ); + # [1] Mount device partition sudo mount ${DEV}2 /mnt || $( echo "<<< error: can't mount" && exit );