http delete error

Fixed an error when try to delete an HTTP Auth user and file is empty or file still doesn't exist.
This commit is contained in:
Cristhian Martínez Ochoa 2018-04-25 14:13:45 -06:00
parent d3830acfc8
commit 1e955d322b

View file

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