From 556a8ecc39c311504de273b00deb28222e0890f3 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Fri, 24 Jul 2015 09:00:14 +0000 Subject: Added ban counter to showbanned --- bash/.bashrc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bash/.bashrc b/bash/.bashrc index 5e0625b..66a722c 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -86,7 +86,14 @@ if exists pfctl && exists sudo; then { for table in "fail2ban" "permaban"; do banned=$(sudo pfctl -t $table -T show 2> /dev/null) - echo -e "$table\n$banned" + + if [ -z "$banned" ]; then + nrBanned="0" + else + nrBanned=$(echo "$banned" | wc -l | awk '{ print $1 }') + fi + + echo -e "$table ($nrBanned)\n$banned" done } fi -- cgit v1.2.3