From 42b858105a7e3e8766251b7bbc45a7eaafe49213 Mon Sep 17 00:00:00 2001 From: sose Date: Wed, 26 Sep 2018 17:11:40 +0200 Subject: [PATCH] Fixed deluser.sh --- deluser.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/deluser.sh b/deluser.sh index 1687dcd..5773af4 100755 --- a/deluser.sh +++ b/deluser.sh @@ -1,7 +1,11 @@ #!/bin/sh SLBRUSER=$1 test -z "$SLBRUSER" && echo "no user provided" && exit -grep -qvx "$SLBRUSER" users.txt && echo "user not found in users.txt, will not delete" && exit +if !(grep -qx "$SLBRUSER" users.txt) +then + echo "user not found in users.txt, will not delete" + exit +fi if ps -o stat= -p $PPID | grep -qv S+ #check if this is being called from listen.py then @@ -13,5 +17,4 @@ lxc stop "$SLBRUSER" lxc delete "$SLBRUSER" sudo rm -rf "$SLBRUSER" sudo userdel "$SLBRUSER" -tr '\n' ' ' < users.txt | sed "s/$SLBRUSER//g" | tr ' ' '\n' > users.temp -mv users.temp users +sed -ie "s/$SLBRUSER .*$//g"