aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xadd-group18
1 files changed, 10 insertions, 8 deletions
diff --git a/add-group b/add-group
index add2213..c27855c 100755
--- a/add-group
+++ b/add-group
@@ -20,16 +20,18 @@ num=$2 # number of packages installed
name=$3 # name of the group
users=$4 # users to add to this group
-SAVED_IFS="$IFS"
-export IFS="$IFS",
-set $users
-IFS="$SAVED_IFS"
-
/usr/sbin/groupadd -r $name > /dev/null 2>&1
-for u in $*; do
- /usr/sbin/usermod -G $name $u > /dev/null 2>&1
-done
+if [ -n "$users" ]; then
+ SAVED_IFS="$IFS"
+ export IFS="$IFS",
+ set $users
+ IFS="$SAVED_IFS"
+
+ for u in $*; do
+ /usr/sbin/usermod -G $name $u > /dev/null 2>&1
+ done
+fi
exit 0