From a6b3d4c805cc0c0ed9bcc0a367088dc0af141966 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Thu, 2 Mar 2017 17:32:51 -0800 Subject: [PATCH] using first partition of source device --- files/opt/duplicate-usb-stick.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/opt/duplicate-usb-stick.sh b/files/opt/duplicate-usb-stick.sh index 2be1aca..3fb7273 100755 --- a/files/opt/duplicate-usb-stick.sh +++ b/files/opt/duplicate-usb-stick.sh @@ -60,10 +60,10 @@ if [ -z "$source_device" ]; then fi partition="${device}1" -end="`sudo parted -s /dev/sdb 'unit b print' | awk '/^ / {print $3}'`" +end="`sudo parted -s \"$source_device\" 'unit b print' | awk '/^ / {print $3}' | head -n 1`" bytes="${end%B}" bytes="${bytes%b}" -start="`sudo parted -s /dev/sdb 'unit b print' | awk '/^ / {print $2}'`" +start="`sudo parted -s \"$source_device\" 'unit b print' | awk '/^ / {print $2}' | head -n 1`" echo "Getting partitions of $device" partitions="`sudo parted -s \"$device\" print|awk '/^ / {print $1}'`"