From 76dacf8ce675c8dd705c6f1e142931898cc88da7 Mon Sep 17 00:00:00 2001 From: David Personette Date: Fri, 20 Jan 2017 16:44:05 -0500 Subject: [PATCH] samba.sh don't try to add a group if one isn't given --- samba.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samba.sh b/samba.sh index 49648e9..f557dce 100755 --- a/samba.sh +++ b/samba.sh @@ -109,7 +109,7 @@ timezone() { local timezone="${1:-EST5EDT}" # id) for user # Return: user added to container user() { local name="${1}" passwd="${2}" id="${3:-""}" group="${4:-""}" - grep -q "^$group:" /etc/group || groupadd "$group" + [[ "$group" ]] && { grep -q "^$group:" /etc/group || groupadd "$group"; } useradd "$name" -M ${id:+-u $id} ${group:+-g $group} echo -e "$passwd\n$passwd" | smbpasswd -s -a "$name" }