user1,password1 user2,password2 etc.. The script: for userdetails in `cat /pathto//users.txt` do user=`echo $userdetails | cut -f 1 -d ,` passwd=`echo $userdetails | cut -f 2 -d ,` echo "useradd -d /user1/kopen3 -p `mkpasswd $passwd` $user" done run the script and redirect the output to a file, e.g: ./createusers.sh > userscript.sh chmod +x userscript.sh