From 19561bd396ee7236e922a778300ac3de5858f33c Mon Sep 17 00:00:00 2001 From: xiagw Date: Thu, 24 Sep 2020 16:06:29 +0700 Subject: [PATCH] Reduce repetitive code --- wireguard-install.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index c752dbf..ac3ea8f 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -314,11 +314,7 @@ function revokeClient() { echo "Select the existing client you want to revoke" grep -E "^### Client" "/etc/wireguard/${SERVER_WG_NIC}.conf" | cut -d ' ' -f 3 | nl -s ') ' until [[ ${CLIENT_NUMBER} -ge 1 && ${CLIENT_NUMBER} -le ${NUMBER_OF_CLIENTS} ]]; do - if [[ ${CLIENT_NUMBER} == '1' ]]; then - read -rp "Select one client [1]: " CLIENT_NUMBER - else - read -rp "Select one client [1-${NUMBER_OF_CLIENTS}]: " CLIENT_NUMBER - fi + read -rp "Select one client [$([[ ${CLIENT_NUMBER} == '1' ]] && echo '1' || echo "1-${NUMBER_OF_CLIENTS}")]: " CLIENT_NUMBER done # match the selected number to a client name