Mailinglist Archive: opensuse-edu (72 mails)

< Previous Next >
Re: [suse-linux-uk-schools] addins users to groups....... 500+
  • From: Thomas Adam <thomas_adam16@xxxxxxxxx>
  • Date: Mon, 4 Aug 2003 15:47:13 +0000 (UTC)
  • Message-id: <20030804154710.32303.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
--- Andrew Nix <andrew.nix@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> This is the command you said would work if i had a cvs file?
>
> > for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM
> -G
> > groupname; done

Hmm, It seems I am having a lapse in my typing. Once and for all, the
_correct_ way is to do:

for i in $(cat ./the_file); do useradd $i -G <groupname>, <more_groups>;
done

> As it was just easier to copy all the usernames into a text file will
> the
> this same command work? If so what do I write for $NUM, as there are no
> columns to be defined? Is there an addgroup cammand that could also do
> the
> same thing or am I barking up the wrong tree?

(see above). Since you only have one column, invoking awk in this case is
superfluous and unnecessary. You might just was well cat the file. You'll
also notice that I have got <groupname> followed by a comma, and then
<moregroups>. This is so that you can specify more than one group to add
if need be.

There is no "addgroup" command, as it is all contained within useradd. In
debian, one can do it more simpler, but this is SuSE, so....

HTH,

-- Thomas Adam

> --
> Andrew Nix
>
> St Pauls Catholic High School
> Firbank Road
> Newall Green
> Wythenshawe
> Manchester
> M23 2YS
> tel: 0161 4375841 ext 168
> fax: 0161 4982030
>
>
>
> --
> To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@xxxxxxxx
> For additional commands, e-mail: suse-linux-uk-schools-help@xxxxxxxx
>

=====
Thomas Adam

"The Linux Weekend Mechanic" -- www.linuxgazette.com

________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/

< Previous Next >
List Navigation
Follow Ups
References