unu*_*tbu 15
虽然单位转换不是非常复杂的数学,但是可能需要减少硬编码数量和shell脚本的想法(而不是计算).如果你的linux系统有units程序,你可以像这样进行单位转换:
% units --terse "244410368 bytes" "MiB"
233.08789
% units --terse "244410368 bytes" "MB"
244.41037
Run Code Online (Sandbox Code Playgroud)
(在Ubuntu上,该units程序由(surprise!)units包提供.)