Improve listing clients

- When listing existing clients, show total and improve output.
This commit is contained in:
hwdsl2 2022-09-26 22:11:58 -05:00
parent 516ff9271e
commit 3e57822d27

View File

@ -617,7 +617,12 @@ else
exit
fi
echo
grep '^# BEGIN_PEER' /etc/wireguard/wg0.conf | cut -d ' ' -f 3
grep '^# BEGIN_PEER' /etc/wireguard/wg0.conf | cut -d ' ' -f 3 | 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
;;
3)
number_of_clients=$(grep -c '^# BEGIN_PEER' /etc/wireguard/wg0.conf)