Creating user accounts

Hi,

I have written a program using shell scripting. When you run the file it will asks you to enter the user name, if the user exists it says " user exists " if not it will displays like " user doesnt exist" and then asks you like " do you want to add user with options Yes or No " if you say yes, again it will asks you enter the user name, automatically the user will be created.

Now, my question is when you run the above program you are able to add or search for a single user. But, I need to know like, at the command prompt i will enter 5 users at a time and it has to create 5 users at a time.

Please help me with the logic behind this, how can i write a program ?

Thanks and regards
Vishwa Prasad :smiley:

Something like

#!/bin/sh
for d in $@
do
      if useradd -m -d /home/$d $d
      then
           passwd $d
      fi
done

which you could have determined with "man useradd".