From ec95ba8097cdec13e3c0124b05e3de331b06ac15 Mon Sep 17 00:00:00 2001 From: Andrew Scheller Date: Mon, 22 Jan 2018 02:39:33 +0000 Subject: [PATCH] `ls` doesn't need `-a` flag when passed a filename --- pishrink.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pishrink.sh b/pishrink.sh index 6cf98f0..38d7266 100755 --- a/pishrink.sh +++ b/pishrink.sh @@ -47,7 +47,7 @@ if [ -n "$2" ]; then fi #Gather info -beforesize=$(ls -lah "$img" | cut -d ' ' -f 5) +beforesize=$(ls -lh "$img" | cut -d ' ' -f 5) parted_output=$(parted -ms "$img" unit B print | tail -n 1) partnum=$(echo "$parted_output" | cut -d ':' -f 1) partstart=$(echo "$parted_output" | cut -d ':' -f 2 | tr -d 'B') @@ -171,6 +171,6 @@ parted -s "$img" unit B mkpart primary $partstart $newpartend >/dev/null #Truncate the file endresult=$(parted -ms "$img" unit B print free | tail -1 | cut -d ':' -f 2 | tr -d 'B') truncate -s $endresult "$img" -aftersize=$(ls -lah "$img" | cut -d ' ' -f 5) +aftersize=$(ls -lh "$img" | cut -d ' ' -f 5) echo "Shrunk $img from $beforesize to $aftersize"