Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法以cat /sys/class/net/wlan0/statistics/rx_bytesMB(兆字节)而不是字节显示返回的结果。
cat /sys/class/net/wlan0/statistics/rx_bytes
感谢您的任何建议;
您可以使用以下命令expr:
expr
# expr $(cat /sys/class/net/wlan0/statistics/rx_bytes) / 1024 / 1024
编辑:由于expr仅适用于整数,因此您可以将bc其用于浮点数,如下所示:
bc
# echo "$(cat /sys/class/net/wlan0/statistics/rx_bytes) / 1024 / 1024" | bc -l