ممكن مساعدتي في كتابة البرنامج التالي مع كتابة شرج لكل خطوة
write a bash program named myuseradd that accepts a list of users as argument
Script syntax: myuseradd <login> [<login> [<login> ..]]
At least one <login> argument must be provided and must not exceed 10 alphanumeric characters.
The script must not use the usedadd or similar commands. It must:
1- Check if user is root. If not the script cannot be run and it exits.
2- Check the number of arguments. If none the script exits.
3- Check if <login> is already used, if yes the script exits.
4- Ask the user to provide the following data:
a. Home directory:
Default is /home/<login>
The script accepts either /home/<string> or /<string>. <string> must
not exceed 10 alphanumeric characters and the entered home directory
must not exist already.
b. Login shell
Default is /bin/bash
The script can accept one of the shells as listed in /etc/shells.
If provided data does not meet conditions, the user is asked to enter the data again
5- Add user with name <login>, provided home directory and login shell to the system's users (/etc/passwd file).
6- Assign userid (must be the first available userid greater or equal to 500).
7- Create a new group with group name <login> and gid same as uid and assign it as primary group. This must be done by adding an entry to /etc/group.If the group already exists, no change is done.
8- Create home directory and set required permissions.
9- Copy startup scripts to the home directory (from /etc/skel).
10- Create a line in /etc/shadow that corresponds to the user with a blank password.
11- Call the passwd program to set the password.
12- Produce an output the summarize what it did.