0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2024-11-17 12:51:33 -05:00

Precise grep pattern, skip function instead of exit

This commit is contained in:
Adrian Dvergsdal 2016-09-11 01:05:01 +02:00
parent 8bc91ed283
commit 0549dfa4af

View file

@ -37,9 +37,9 @@ function createUser() {
exit 1
fi
if $(cat /etc/passwd | cut -d: -f1 | grep -q "$user"); then
echo "FATAL: User \"$user\" already exists."
exit 2
if $(cat /etc/passwd | cut -d: -f1 | grep -q "^$user:"); then
echo "WARNING: User \"$user\" already exists. Skipping."
return 0
fi
useraddOptions="--no-user-group"