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:
parent
d3830acfc8
commit
1e955d322b
|
@ -47,8 +47,8 @@ if [[ $opt == "-add" ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
elif [[ $opt == "-delete" ]]; then
|
elif [[ $opt == "-delete" ]]; then
|
||||||
[[ -z $value ]] && read -p "${blu}HTTP-Auth User: ${end}" userpurge || userpurge=$value
|
[[ -z $value ]] && read -p "${blu}HTTP-Auth User: ${end}" userpurge || userpurge=$value
|
||||||
exist=$( grep -E "^${userpurge}:" /etc/nginx/.htpasswd )
|
[[ -a /etc/nginx/.htpasswd ]] && exist=$( grep -E "^${userpurge}:" /etc/nginx/.htpasswd )
|
||||||
if [[ ! -a /etc/nginx/.htpasswd || -z $exist ]]; then
|
if [[ -z $exist ]]; then
|
||||||
echo "${red}User '$userpurge' does not exist!${end}"
|
echo "${red}User '$userpurge' does not exist!${end}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue