From 1e955d322b46fc924281e6cd0b2306a7054ff0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Wed, 25 Apr 2018 14:13:45 -0600 Subject: [PATCH] http delete error Fixed an error when try to delete an HTTP Auth user and file is empty or file still doesn't exist. --- plugins/httpauth | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/httpauth b/plugins/httpauth index 68dd046..37c7267 100644 --- a/plugins/httpauth +++ b/plugins/httpauth @@ -47,8 +47,8 @@ if [[ $opt == "-add" ]]; then echo "" elif [[ $opt == "-delete" ]]; then [[ -z $value ]] && read -p "${blu}HTTP-Auth User: ${end}" userpurge || userpurge=$value - exist=$( grep -E "^${userpurge}:" /etc/nginx/.htpasswd ) - if [[ ! -a /etc/nginx/.htpasswd || -z $exist ]]; then + [[ -a /etc/nginx/.htpasswd ]] && exist=$( grep -E "^${userpurge}:" /etc/nginx/.htpasswd ) + if [[ -z $exist ]]; then echo "${red}User '$userpurge' does not exist!${end}" exit 1 fi