Quote:
Originally posted by homey
Here is an example using read to get the information. It uses a space as a field separator by default.
In this case, the names.txt has information which looks like this...
fred 500
sue 600
tim 500
joe 500
while read USER GROUP reads user then group from each line.
NEW_USERS="/home/names.txt"
cat ${NEW_USERS} | \
while read USER GROUP
do
adduser ${USER} -g ${GROUP}
|
Thank you very much for your reply.......
although it seems to me it works but I have certain issues related to it....
my file from where I am reading looks like this...
(configuration.test)/////////////////
release test_0.1
patch patch1
//////////////////////////
and my script which is reading this file is:
///////////////////////////////////////////////////////////////////
read_file="/usr/configuration.test"
cat ${read_file}|\
while read USER GROUP
do
adduser ${USER} -g ${GROUP}
done
//////////////////////////////////////////////////
and my output is:
///////////////////////////////////////////////
adduser: unknown group test_0.1
adduser: option requires an argument -- g
usage: adduser [-u uid [-o]] [-g group] [-G group,...]
[-d home] [-s shell] [-c comment] [-m [-k template]]
[-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name
adduser -D [-g group] [-b base] [-s shell]
[-f inactive] [-e expire ]
adduser: unknown group patch1
adduser: option requires an argument -- g
usage: adduser [-u uid [-o]] [-g group] [-G group,...]
[-d home] [-s shell] [-c comment] [-m [-k template]]
[-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name
adduser -D [-g group] [-b base] [-s shell]
[-f inactive] [-e expire ]
adduser: option requires an argument -- g
usage: adduser [-u uid [-o]] [-g group] [-G group,...]
[-d home] [-s shell] [-c comment] [-m [-k template]]
[-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name
adduser -D [-g group] [-b base] [-s shell]
[-f inactive] [-e expire ]
/////////////////////////////////////
I am not sure why I am getting all that options too...........??????????