[K12OSN] creating accounts

Les Mikesell les at futuresource.com
Thu Sep 29 12:54:08 UTC 2005


On Thu, 2005-09-29 at 01:59, gKw-X wrote:
> I need to create a large number of accounts. I've whipped up a program 
> to generate a script from a text list of students. What it generates 
> looks like this:
> 
> groupadd "Grade3"
> groupadd "Grade2"
> groupadd "Grade1"
> groupadd "Grade6"
> groupadd "Grade7"
> groupadd "Grade4"
> groupadd "GradeK"
> groupadd "Grade5"
> useradd -c "Kayla Abad" -d /home/kabad -g Grade3 kabad -p kaab
> 
> Etc, one useradd line for each student. Does that look correct?

With a little practice, you can do stuff like that in seconds
(well, minutes anyway) with :%s/search/replace/ expressions
in vi starting from a delimited list.

>  I'm 
> still new to linux, how can I run this script?

sh filename
will run it without having to make it executable
(or you could "1G!sh" from inside vi to send the
buffer to the shell without writing the file...)
sh -x filename
will execute it, showing you the lines as they
are executed.
Or chmod +x filename
./filename
to execute it directly.

-- 
  Les Mikesell
    les at futuresource.com





More information about the K12OSN mailing list