diff options
author | Erich Eckner <git@eckner.net> | 2019-05-03 22:19:29 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-05-03 22:19:29 +0200 |
commit | a906e3d5cd23be687918037096df4ef63f8eb82f (patch) | |
tree | 345850814e0ed7d7a3fab75d369663874e7dda41 | |
parent | bc1d178edbe7c7b74a644d0fbe14e0fc0f5bf83c (diff) | |
download | hardlinkedBackups-a906e3d5cd23be687918037096df4ef63f8eb82f.tar.xz |
backup-progress: show first decimal of total sizev1.4.5
-rwxr-xr-x | backup-progress.in | 4 |
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 |