summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-05-03 22:19:29 +0200
committerErich Eckner <git@eckner.net>2019-05-03 22:19:29 +0200
commita906e3d5cd23be687918037096df4ef63f8eb82f (patch)
tree345850814e0ed7d7a3fab75d369663874e7dda41
parentbc1d178edbe7c7b74a644d0fbe14e0fc0f5bf83c (diff)
downloadhardlinkedBackups-a906e3d5cd23be687918037096df4ef63f8eb82f.tar.xz
backup-progress: show first decimal of total sizev1.4.5
-rwxr-xr-xbackup-progress.in4
1 files changed, 3 insertions, 1 deletions
diff --git a/backup-progress.in b/backup-progress.in
index 61f8c1e..4d4dde9 100755
--- a/backup-progress.in
+++ b/backup-progress.in
@@ -23,15 +23,17 @@ for backupID in "${!backups[@]}"; do
| awk '{print $1}'
)
size="${current_size}"
+ decimal=''
for unit in '' k M G T P Y; do
if [ "${size}" -lt 1024 ]; then
break
fi
+ decimal=".$(((size%1024*10)/1024))"
size=$((size/1024))
done
percentage=$(
printf '100*%s/%s\n' "${current_size}" "${last_size}" \
| bc -l
)
- printf '%6.2f %% (%s %sB) %s\n' "${percentage}" "${size}" "${unit}" "${backupID}"
+ printf '%6.2f %% (%s%s %sB) %s\n' "${percentage}" "${size}" "${decimal}" "${unit}" "${backupID}"
done