From owner-freebsd-questions@FreeBSD.ORG Sun Jul 3 17:03:42 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 AB1D116A41C for ; Sun, 3 Jul 2005 17:03:42 +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 390E043D46 for ; Sun, 3 Jul 2005 17:03:42 +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 <20050703170341.OCYQ14360.mta13.adelphia.net@barbish>; Sun, 3 Jul 2005 13:03:41 -0400 From: "fbsd_user" To: "Alejandro Pulver" Date: Sun, 3 Jul 2005 13:03:40 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <20050703132546.62438d76@phobos.mars.bsd> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Cc: "freebsd-questions@FreeBSD. ORG" Subject: RE: help with sh script 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: Sun, 03 Jul 2005 17:03:42 -0000 On Sun, 3 Jul 2005 12:14:05 -0400 "fbsd_user" wrote: >> Thanks but I need a little more help. >> >> num_ip="(printf $raw_ip | sed 's/\.//g')" >> >> gives me a error. >> >> What would the correct syntax be? >> >> I am trying to write script to insert rules into PF firewall >> on 5.4. using pf anchors. >> > >Hello, > >The problem here is that > >num_ip="(printf $raw_ip | sed 's/\.//g')" > >makes num_ip equal to > >(printf $raw_ip | sed 's/\.//g') > >instead of its output. > >To assign the output of a command use "`": > >num_ip=`(printf $raw_ip | sed 's/\.//g')` > >Also the subshell (the "()") is not needed: > >num_ip=`printf $raw_ip | sed 's/\.//g'` > >Hope that helps. > >Best Regards, >Ale Thanks that was just what I needed. Now building on that I tried this std_text='No ALTQ support in kernel ALTQ related functions disabled' ret_ob=`(echo $outrule) | pfctl -a doorman_ob:$session_name_ob -f - 2>&1` ret_ob=`printf $ret_ob | sed 's/\$std_text//g'` The goal here is to remove the std_text from the output of the pftctl command. I get this error "printf missing format character" Does sed need different syntax or have I got it all wrong?