#!/bin/bash # $1 = username, $2 = comma-separated groups useradd -G "$2" -m -s /bin/bash "$1" || usermod -aG "$2" "$1"