###在這里也可以設(shè)置用戶所屬的用戶組
for a
do
echo "/home/student/$a"
adduser --home /home/student/$a $a
done
(3)執(zhí)行該腳本文件,查看執(zhí)行過程
root@liu:/home/liu/Desktop/Dos# sh t.sh `cat < username.txt`
/home/student/stu1
Adding user `stu1' ...
Adding new group `stu1' (1002) ...
Adding new user `stu1' (1001) with group `stu1' ...
Creating home directory `/home/student/stu1' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for stu1
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]