commit a6bff9a31c331bada2c1ff2592aba52cf66bd439 parent 52308d035cd102e11327b2e98693a62ac597c1af Author: Cem Keylan <cem@ckyln.com> Date: Sun, 13 Sep 2020 19:12:10 +0300 sb_storage: simplify Diffstat:
M | func/sb_storage | | | 9 | ++++++--- |
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/func/sb_storage b/func/sb_storage @@ -5,8 +5,11 @@ storage() { DISK="$1" [ -z "$DISK" ] && DISK="/" printf "$DISK: " - command df -h | grep "$DISK\$" | awk '{print $3}' | sed s/G// | tr -d '\n' - printf "/" - command df -h | grep "$DISK\$" | awk '{print $2}' | sed s/G/\ GB/ | tr -d '\n' + command df -h | while read -r _ size used _ _ mnt; do + [ "$mnt" = "$DISK" ] || continue + used=${used%G} size=${size%G} + printf "$used/$size GB" + break + done printf " $DELIMITER " }