help with she script

Alejandro Pulver alejandro at varnet.biz
Sun Jul 3 21:15:32 GMT 2005


On Sun, 3 Jul 2005 16:47:24 -0400
"fbsd_user" <fbsd_user at a1poweruser.com> wrote:

> 
> Thanks guys your solutions have worked and I am learning allot along
> the way.
> 

You are welcome.

> This is my last coding problem.
> 
> 
> target="check-state"
> 
> # Find the rule number of the target rule where you want the doorman
> # pass rules inserted before.
> 
> ruleno=`ipfw list | sed -n -e "s/00\([0-9]*\) $target/\1/p"`
> 
> The output of 'ipfw list' looks like this
> 
> nnnnn  a 5 position sequence rule number
> blank  followed by a empty single position
> x-x    a 10 to 80 position rule text
> 
> 
> When the rule text matches the target text I want the
> first 5 position rule number to go into ruleno.
> 
> Large rules files may use all 5 positions and then
> the above code will fail to get the rule number.
> Tried to remove the s/00\ but had syntax problems.
> 

Hello,

I do not have ipfw, and I do not know how the rules are supposed to be,
and how they have to be processed.

Could you please send me some example rules, and the expected output to
be assigned to "ruleno"?

Thanks and Best Regards,
Ale


More information about the freebsd-questions mailing list