From owner-freebsd-questions@FreeBSD.ORG Wed Jun 29 02:52:14 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 6773616A41C for ; Wed, 29 Jun 2005 02:52:14 +0000 (GMT) (envelope-from fbsd_user@a1poweruser.com) Received: from mta13.adelphia.net (mta13.adelphia.net [68.168.78.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id 00D8543D53 for ; Wed, 29 Jun 2005 02:52:13 +0000 (GMT) (envelope-from fbsd_user@a1poweruser.com) Received: from barbish ([69.172.31.81]) by mta13.adelphia.net (InterMail vM.6.01.04.01 201-2131-118-101-20041129) with SMTP id <20050629025212.TOCM14360.mta13.adelphia.net@barbish> for ; Tue, 28 Jun 2005 22:52:12 -0400 From: "fbsd_user" To: "freebsd-questions@FreeBSD. ORG" Date: Tue, 28 Jun 2005 22:52:12 -0400 Message-ID: MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Shell script help X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: fbsd_user@a1poweruser.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 02:52:14 -0000 My sh shell script ability is not that good. Have 2 simple coding problems. How do I code a statement to subtract one from a field. $rulenum = $rulenum - 1 $rulenum = '$rulenum - 1' one='1' $rulenum = $rulenum - $one $rulenum='$rulenum - $one' None of that works. must really be simple. I also have this line inruleno=`ipfw list | sed -n -e "s/00\([0-9]*\) $inblock/\1/p"` This works ok, the search argument is s/00\ but that is not good enough because the number can be 0 to 65535. The sed -n -e "s/00\([0-9]*\ needs to be changed to just return the first word. Thanks for any help you can give.