sslug-teknik team mailing list archive
-
sslug-teknik team
-
Mailing list archive
-
Message #16039
Re: Masse-oprette brugere
On Sun, 5 Dec 1999, torben fjerdingstad wrote:
> Morten Christensen skrev:
>
> > Kan I give hjælp til, hvordan jeg tager oplysningerne
> > fra en tekstfil, eller et afsnit i scriptet, hvor de står med
> > en linie pr. bruger f.eks. sådan her, så jeg hurtigt kan
> > oprette 40-50 brugere:
> >
> > brugernavn linux-password samba-password ekstra-gruppe
>
> Hvis dit script f.eks. hedder opret-bruger, kan du bare
> køre det i en for løkke indtil der ikke er flere linjer
> i tekstfilen:
>
> for linje in `cat tekstfil`; do opret-bruger $linje;done
Kun hvis man har "kun et felt" pr. linie. Hvis man har mellemrum, vil hver
"token" blive sendt som parameter.
> Hvis det skal være smartere kan man bruge awk eller perl.
Off the head. (Hvor er Ole Tange :-)
perl -ne 'system("opret-bruger $_");' < bruger-liste
I praksis vil man nok check fejl, mv.
Mads
--
Mads Bondo Dydensborg. madsdyd@xxxxxxxxxxxx
The point is to decide what your needs are, pick an editor that looks like
it may fit them and then MASTER it. Learn every little nuance and key
stroke. Not just the easy stuff you pick up in an hour or two but especially
the obscure stuff. Learn it so well that your mind can stay about two steps
ahead of hands even when using the arcane commands and keystrokes. Then you
can edit in front of crowds and people will ohh and awe. Source code will
fear you. Project managers will want you.
- Dana S. Wheeler, M.D. on emacs/vi
References