#!/bin/bash
USER_NAME="${USER_NAME}";
USER_DISPLAYNAME="${USER_DISPLAYNAME}";
USER_GROUPS="${USER_GROUPS}";
useradd --create-home --comment "$USER_DISPLAYNAME" --groups wheel "$USER_NAME";
usermod -aG wheel "$USER_NAME";

if [ ! -z "$USER_GROUPS" ]
then
    usermod -aG "$USER_GROUPS" "$USER_NAME";
fi;

echo "Please Choose a New Password for User \`$USER_NAME\`";

while ! passwd "$USER_NAME";
do
    echo "An error occurred! Please try again."
done;