From owner-freebsd-questions@FreeBSD.ORG Fri Aug 5 20:12:13 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0447816A420 for ; Fri, 5 Aug 2005 20:12:13 +0000 (GMT) (envelope-from virtual@virtualgod.net) Received: from comet.customhostingservers.com (comet.customhostingservers.com [72.36.144.146]) by mx1.FreeBSD.org (Postfix) with ESMTP id 236D443D49 for ; Fri, 5 Aug 2005 20:12:07 +0000 (GMT) (envelope-from virtual@virtualgod.net) Received: from virtualg by comet.customhostingservers.com with local (Exim 4.51) id 1E18Y4-0000Iw-A9 for freebsd-questions@freebsd.org; Fri, 05 Aug 2005 15:12:08 -0500 Received: from 82.77.180.238 ([82.77.180.238]) (SquirrelMail authenticated user virtual@virtualgod.net) by virtualgod.net with HTTP; Fri, 5 Aug 2005 15:12:08 -0500 (CDT) Message-ID: <3463.82.77.180.238.1123272728.squirrel@virtualgod.net> Date: Fri, 5 Aug 2005 15:12:08 -0500 (CDT) From: virtual@virtualgod.net To: freebsd-questions@freebsd.org User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - comet.customhostingservers.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [32634 32003] / [47 12] X-AntiAbuse: Sender Address Domain - virtualgod.net X-Source: /usr/local/cpanel/3rdparty/bin/php X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/3rdparty/squirrelmail/src/compose.php X-Source-Dir: :/base/3rdparty/squirrelmail/src Subject: bash script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2005 20:12:13 -0000 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.