Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jul 2005 13:25:46 -0300
From:      Alejandro Pulver <alejandro@varnet.biz>
To:        fbsd_user@a1poweruser.com
Cc:        "freebsd-questions@FreeBSD. ORG" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: help with sh script
Message-ID:  <20050703132546.62438d76@phobos.mars.bsd>
In-Reply-To: <MIEPLLIBMLEEABPDBIEGIEBIHIAA.fbsd_user@a1poweruser.com>
References:  <6BD492A9-2A38-49C8-B0E2-507F1B9964B2@amadeus.demon.nl> <MIEPLLIBMLEEABPDBIEGIEBIHIAA.fbsd_user@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 3 Jul 2005 12:14:05 -0400
"fbsd_user" <fbsd_user@a1poweruser.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050703132546.62438d76>