diff --git a/src/freedombone-app-tahoelafs b/src/freedombone-app-tahoelafs index 7e74baeb..117190d6 100755 --- a/src/freedombone-app-tahoelafs +++ b/src/freedombone-app-tahoelafs @@ -65,7 +65,7 @@ function add_user_tahoelafs { new_username="$1" new_user_password="$2" ${PROJECT_NAME}-pass -u $new_username -a tahoelafs -p "$new_user_password" - if grep "${new_username}:" /etc/nginx/.htpasswd-tahoelafs; then + if grep -q "${new_username}:" /etc/nginx/.htpasswd-tahoelafs; then sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs fi echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username} @@ -75,7 +75,7 @@ function add_user_tahoelafs { function remove_user_tahoelafs { remove_username="$1" ${PROJECT_NAME}-pass -u $remove_username --rmapp tahoelafs - if grep "${remove_username}:" /etc/nginx/.htpasswd-tahoelafs; then + if grep -q "${remove_username}:" /etc/nginx/.htpasswd-tahoelafs; then sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs fi } @@ -84,7 +84,7 @@ function change_password_tahoelafs { change_username="$1" change_password="$2" ${PROJECT_NAME}-pass -u $change_username -a tahoelafs -p "$change_password" - if grep "${change_username}:" /etc/nginx/.htpasswd-tahoelafs; then + if grep -q "${change_username}:" /etc/nginx/.htpasswd-tahoelafs; then sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs fi echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}