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: Thu, 7 Aug 2003 09:31:51 +0000 (UTC)
  • Message-id: <20030807093145.27709.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
--- Andrew Nix <andrew.nix@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> > --- 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
>
> I tried this command but i very time I run it, it just says group
> unknown.
> This is the exact command I issue:
>
> for i in $(cat ./Group\ Adding); do useradd $i -G @Students; done

Yes, "@students" suggest a perl array, in which case Bash cannot expand
it.

-- Thomas Adam

> Im in the directory where the list of users is when the command is run.
> Can anyone see if Im doing something wrong?
>
> > 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/
> >
> > --
> > To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@xxxxxxxx For
> > additional commands, e-mail: suse-linux-uk-schools-help@xxxxxxxx
>
>
>
>
> --
> 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
References