From 1b20eadf229d97aef2c90076dcfbf2556e88877b Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Mon, 26 Sep 2022 22:08:59 -0500 Subject: [PATCH] Improve listing clients - When listing existing clients, show total and improve output. --- openvpn-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index b9ae3f4..50e883b 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -689,7 +689,12 @@ else exit fi echo - tail -n +2 /etc/openvpn/server/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 + tail -n +2 /etc/openvpn/server/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | nl -s ') ' + if [ "$number_of_clients" = 1 ]; then + printf '\n%s\n' "Total: 1 client" + elif [ -n "$number_of_clients" ]; then + printf '\n%s\n' "Total: $number_of_clients clients" + fi ;; 4) number_of_clients=$(tail -n +2 /etc/openvpn/server/easy-rsa/pki/index.txt | grep -c "^V")