From bcb605a9ca632dc1b0e336113fd0405eebff5979 Mon Sep 17 00:00:00 2001 From: q Date: Sun, 12 Aug 2018 15:33:38 +0300 Subject: [PATCH] fastdu help was missing count -c --- files/fastdu | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/files/fastdu b/files/fastdu index bcdb414..7c2beef 100755 --- a/files/fastdu +++ b/files/fastdu @@ -5,6 +5,7 @@ function helpexit() { echo "Returns only the size as number" echo " -h Human readable units" echo " -s Summary mode, otherwise each argument folder calculated separate" + echo " -c Count files instead of summarizing sizes" echo " --help This help" exit } @@ -21,8 +22,8 @@ function filesize() { split("B kB MB GB TB PB EB ZB",type) for(i=7;y < 1;i--) y = x / (2^(10*i)) - str=int(y*10)/10 " " type[i+2] - if (x==0) { str = "0 B" } + str=int(y*10)/10 " " type[i+2] + if (i==-1) { str = x " B" } print str }' || return $? } @@ -30,7 +31,7 @@ function siprefix() { # Return a SI prefixed string from integer [ "$1" = "0" ] && { - echo "0" + echo "0 " return 0 } @@ -38,9 +39,8 @@ function siprefix() { split("_ k M G T P E Z",type) for(i=7;y < 1;i--) y = x / (10^(3*i)) - str=int(y*10)/10 " " type[i+2] - if (x==0) { str = "0" } - if (i==-1) { str = x } + str=int(y*10)/10 " " type[i+2] + if (i==-1) { str = x " " } print str }' || return $? } @@ -50,7 +50,7 @@ function processfolder() { if [[ "$COUNT" -eq 1 ]]; then countfiles "$@" else - displaysize "$@" + displaysize "$@" fi } @@ -73,12 +73,12 @@ function displaysize() { # Get options what=() for (( i=1; i<=$#; i++ )); do - [[ "${!i}" = "--help" ]] && helpexit + [[ "${!i}" = "--help" ]] && helpexit [[ "${!i}" = "-h" ]] && { HUMAN=1; continue; } [[ "${!i}" = "-c" ]] && { COUNT=1; continue; } [[ "${!i}" = "-s" ]] && { SUMMARY=1; continue; } what+=( "${!i}" ) -done +done [[ -z "${what[@]}" ]] && what="." # If only one entry, dont print the name [[ "${#what[@]}" -eq 1 ]] && SUMMARY=1