Stuff
public shellscript v1 · immutablefunction human_size () { SIZES="Bytes KBytes MBytes GBytes TBytes PBytes EBytes" VALUE=$( echo "scale=1; size=$1; i=0; " \ "while (size > 1000) { size /= 1024; i=i+1; };" \ " print size, \" \", i + 1, \"\n\";" | bc ) COUNT=$( echo $VALUE | cut -f 2 -d ' ' ) SIZE=$( echo $VALUE | cut -f 1 -d ' ' ) RANGE="$( echo $SIZES | cut -f $COUNT -d ' ' )" echo "$SIZE $RANGE" return }