From a906e3d5cd23be687918037096df4ef63f8eb82f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 3 May 2019 22:19:29 +0200 Subject: backup-progress: show first decimal of total size --- backup-progress.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3