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