From owner-freebsd-questions@FreeBSD.ORG Sun Jul 3 17:27:48 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 0F7B516A41C for ; Sun, 3 Jul 2005 17:27:48 +0000 (GMT) (envelope-from FreeBSD@amadeus.demon.nl) Received: from post-22.mail.nl.demon.net (post-22.mail.nl.demon.net [194.159.73.192]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9EDD743D48 for ; Sun, 3 Jul 2005 17:27:47 +0000 (GMT) (envelope-from FreeBSD@amadeus.demon.nl) Received: from amadeus.demon.nl ([82.161.18.200]:55956 helo=[10.0.1.1]) by post-22.mail.nl.demon.net with esmtp (Exim 4.43) id 1Dp8Fu-0001yq-2Y; Sun, 03 Jul 2005 17:27:46 +0000 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v730) X-Priority: 3 (Normal) Message-Id: From: FreeBSD questions mailing list Date: Sun, 3 Jul 2005 19:27:36 +0200 To: fbsd_user@a1poweruser.com X-Mailer: Apple Mail (2.730) X-Mailman-Approved-At: Mon, 04 Jul 2005 14:02:43 +0000 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Alejandro Pulver , "freebsd-questions@FreeBSD. ORG" Subject: Re: help with sh 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: Sun, 03 Jul 2005 17:27:48 -0000 On 03 jul 2005, at 19:03, fbsd_user wrote: > 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? > printf needs " surrounding the arguments: printf "$ret_ob" is the right syntax... Arno