Improve listing clients

- When listing existing clients, show total and improve output.
This commit is contained in:
hwdsl2
2022-09-26 22:08:59 -05:00
parent 7c754961aa
commit 1b20eadf22

View File

@@ -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")