#!/bin/bash

echo "Enter new username: "
read USERNAME

echo "Enter disk quota (GB): "
read QUOTA_SIZE

echo "Enter an expiration date (yyyy-mm-dd or leave blank) : "
read EXPIRATION_DATE

echo "Enter shell (leave empty for bash): "
read LOGIN_SHELL

if [[ -z $LOGIN_SHELL ]]
then
    LOGIN_SHELL="/bin/bash"
    #chage -E $EXPIRATION_DATE
fi


if [[ -z $EXPIRATION_DATE ]]
then
    EXPIRATION_DATE="None"
    useradd -G developer -s $LOGIN_SHELL $USERNAME
else
    useradd -G developer -s $LOGIN_SHELL -e $EXPIRATION_DATE $USERNAME
fi

passwd $USERNAME

chage -d 0 $USERNAME

echo ""
echo "Creating new user: "
echo "User: $USERNAME"
echo "Quota: $QUOTA_SIZE GB"
echo "Expiration: $EXPIRATION_DATE"
echo "Login shell: $LOGIN_SHELL"
