Date: Fri, 5 Aug 2005 15:12:08 -0500 (CDT) From: virtual@virtualgod.net To: freebsd-questions@freebsd.org Subject: bash script Message-ID: <3463.82.77.180.238.1123272728.squirrel@virtualgod.net>
next in thread | raw e-mail | index | archive | help
My knowledge in bash scripting is about medium not very advanced and all so I am not attempting to make a connection limiter but what I want to make is a script that checks the irc connections off a certain user and takes some actions, mostly of this I know how to do but I got stuck at this : I write in a file we will call it users.allow the following: Virtual 5 Test 7 Server 9 Power 2 This will be the file that will hold the limit of the users from where the script reads when checks. So my script will read from this file and if the user Virtual for example has more than 5 connections he will kill all his processes that are running in background. But what what I don`t know how to do is make the script read, for example if I start the script he starts reading from users.allow, I want it to read an take each line, first taking the line 1 with user Virtual and setting to a variable the number it has near it like $allow=5, next after it finishes the process for Virtual takes Test etc. So my need would be how can I get the script to read first line, do the process I will make for it, then take the next line and do the process for that user until end of file. And also after taking the first line for example reading only the first block in it, the one with user so it can set $user=Virtual and then to take the path with the number. I would greatly apreciate if you can help me with this issue, I really need this script but didn`t know what to look in the manuals for etc. Also if you know a similar script please let me know.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3463.82.77.180.238.1123272728.squirrel>