From 4eaa335c7c7bd5f114243b6c40c56c07d3f9c297 Mon Sep 17 00:00:00 2001 From: Mikel Bravo Date: Wed, 22 Sep 2021 16:46:53 +0200 Subject: [PATCH] Shows leading 0. on network bandwidth values --- scripts/network_bandwith.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/network_bandwith.sh b/scripts/network_bandwith.sh index 675f39b..26a7890 100755 --- a/scripts/network_bandwith.sh +++ b/scripts/network_bandwith.sh @@ -18,8 +18,8 @@ main() { total_download_bps=$(expr $final_download - $initial_download) total_upload_bps=$(expr $final_upload - $initial_upload) - total_download_kbps=$(echo "scale=2; $total_download_bps / 1024" | bc) - total_upload_kbps=$(echo "scale=2; $total_upload_bps / 1024" | bc) + total_download_kbps=$(echo "$total_download_bps 1024" | awk '{printf "%.2f \n", $1/$2}') + total_upload_kbps=$(echo "$total_upload_bps 1024" | awk '{printf "%.2f \n", $1/$2}') echo "↓ $total_download_kbps kB/s • ↑ $total_upload_kbps kB/s" done