better formatting for fastdu humanreadable
This commit is contained in:
11
files/fastdu
11
files/fastdu
@@ -13,7 +13,7 @@ function filesize() {
|
|||||||
# Usage: filesize 10000
|
# Usage: filesize 10000
|
||||||
|
|
||||||
[ "$1" = "0" ] && {
|
[ "$1" = "0" ] && {
|
||||||
echo "0 B"
|
echo "0 B"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ function filesize() {
|
|||||||
for(i=7;y < 1;i--)
|
for(i=7;y < 1;i--)
|
||||||
y = x / (2^(10*i))
|
y = x / (2^(10*i))
|
||||||
str=int(y*10)/10 " " type[i+2]
|
str=int(y*10)/10 " " type[i+2]
|
||||||
if (x==0) { str = "0 B" }
|
if (x==0) { str = "0 B" }
|
||||||
print str
|
print str
|
||||||
}' || return $?
|
}' || return $?
|
||||||
}
|
}
|
||||||
@@ -87,9 +87,14 @@ if [[ "$SUMMARY" -eq 1 ]]; then
|
|||||||
# Display one line
|
# Display one line
|
||||||
processfolder "${what[@]}"
|
processfolder "${what[@]}"
|
||||||
else
|
else
|
||||||
|
if [[ "$HUMAN" -eq 1 ]]; then
|
||||||
|
FORMAT="%8s %s\n"
|
||||||
|
else
|
||||||
|
FORMAT="%d\t%s\n"
|
||||||
|
fi
|
||||||
# One size for each argument
|
# One size for each argument
|
||||||
for dir in "${what[@]}"; do
|
for dir in "${what[@]}"; do
|
||||||
printf "%s\t%s\n" "$( processfolder "$dir" )" "$dir"
|
printf "$FORMAT" "$( processfolder "$dir" )" "$dir"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user