format memory better
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
function filesize {
|
||||
awk 'BEGIN{ x = '$1'
|
||||
split("B KB MB GB TB PB",type)
|
||||
for(i=5;y < 1;i--)
|
||||
split("K M G T P",type)
|
||||
for(i=5;y < 0.1;i--)
|
||||
y = x / (2^(10*i))
|
||||
str=int(y*10)/10
|
||||
str=int(y*10)/10 type[i+2]
|
||||
if (x==0) { str = "0" }
|
||||
print str
|
||||
}' || return $?
|
||||
|
||||
Reference in New Issue
Block a user