I want to write a shell script which will add list of users, defined in users.txt
, to multiple existing groups.
For example, I have a
, b
, c
, d
, e
, f
, g
users which will be added to the groups according to script, and I have p
, q
, r
, s
, t
groups. Below is the expected output of /etc/groups
file :
p:x:10029:a,c,d
q:x:10030:b,c,f,g
r:x:10031:a,b,c,e
s:x:10032:c,g
t:x:10033:a,b,c,d,e
so how to achieve this ?
users.txt
input file? – lgeorget Jul 17 '14 at 07:21p
will always have usersa, b, f
likewise other groups too would have some users. – Rahul Jul 17 '14 at 07:54