Sure
Code:
#! /bin/bash
NEW_USERS="/home/nerd/userlist.txt"
HOME_BASE="/home/"
while IFS="," read USER GROUP COMMENT PASSWORD;do
useradd -c "${COMMENT}" -G ${GROUP} -m -d ${HOME_BASE}${USER} ${USER}
echo $USER
echo $PASSWORD | passwd $USER --stdin
echo; echo "User $USER password change!"
chage -d 0 $USER
done < "$NEW_USERS"
in your input file use "," instead of " " to separate the fields
the IFS="," is making the
while read use , as the Input Field Separator
To protect from wordsplitting, wrap the field which contains a space with ""
Your input file would look like this
Code:
es666d,group1,Nerd GZ,init1234