From 67b31c75e4c0eb40dbffd6d463111401d393ac3b Mon Sep 17 00:00:00 2001 From: Tercio Gaudencio Filho Date: Wed, 16 Nov 2016 17:55:26 -0200 Subject: [PATCH] Added a check before integer comparison --- openvpn-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 119428d..159c265 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -111,7 +111,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then else read -p "Select one client [1-$NUMBEROFCLIENTS]: " CLIENTNUMBER fi - if [[ "$CLIENTNUMBER" -ge 1 -a "$CLIENTNUMBER" -le $NUMBEROFCLIENTS ]]; then + if [[ "$CLIENTNUMBER" =~ ^[0-9]+$ ]] && [[ "$CLIENTNUMBER" -ge 1 ]] && [[ "$CLIENTNUMBER" -le $NUMBEROFCLIENTS ]]; then CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p) cd /etc/openvpn/easy-rsa/ ./easyrsa --batch revoke $CLIENT