Hi Mike042
This is my script.
# vi addingusers
cat /etc/passwd | while read user passwd uid gid comment dir shell
do
useradd -p $passwd -u $uid -g $gid -c "$comment" -d $dir -s $shell
done
~
This is the display of /etc/passwd file.
# cat /etc/passwd
root:x:0:1:Super-User:/:/usr/bin/ksh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
smmsp:x:25:25:SendMail Message Submission Program:/:
listen:x:37:4:Network Admin:/usr/net/nls:
nobody:x:60001:60001:Nobody:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x Nobody:/:
rao_sr:x:501:14:Srinivasa Rao Cherukuri:/export/home/rao_sr:/usr/bin/ksh
When executing the script I am getting errors.
# ./Useradd
UX: useradd: ERROR: invalid syntax.
usage: useradd [-u uid [-o] | -g group | -G group[[,group]...] | -d dir |
-s shell | -c comment | -m [-k skel_dir] | -f inactive |
-e expire | -A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]]
-p project [, project ...] login
useradd -D [-g group | -b base_dir | -f inactive | -e expire
-A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]] |
-p project
--------------------------------
------------------------------------
It goes like that
Where is the problem?
Thanks in advance