[K12OSN] Scripting help...how to read lines from a text file

David Trask dtrask at vcsvikings.org
Tue Oct 4 15:33:51 UTC 2005


 Hi,

I'm trying to write a script to log off kindergarten kids.  TeacherTool
and Fl_TeacherTool will work, but I'd like to make it easier.  Here's what
I'm trying to do....

I have a script that I call "stop"  (usage is:  stop username) which
simply kills the user and all associated processes...very effective.  What
I'm trying to do is write another script that will read the usernames from
a list in a text file.  

I know how to get names from /home....

for x in `ls /home`; do

But now I need to know how to read each line in a text file that looks
something like:

mjones
ssmith
jdoe
rhuard
gwelch

and execute the command against it.....how can I do this?  I want the
script to read each line....execute the stop command and then do the next
line....

David N. Trask
Technology Teacher/Coordinator
Vassalboro Community School
dtrask at vcsvikings.org
(207)923-3100




More information about the K12OSN mailing list