hugle wrote:
Hello all.
I have a little problem in here.
Actulay i think, that bash doesn't caount good, look:

cat bin/users | wc -l
so the file contains 1877 lines

cat bin/users:
/sbin/ipfw -q delete 2001 >/dev/null 2>&1 &
/sbin/ipfw -q add 2001 count ip from to not me in via fxp0 >/dev/null 2>&1 
/sbin/ipfw -q delete 2002 >/dev/null 2>&1 &
/sbin/ipfw -q add 2002 count ip from not me to out via fxp0 >/dev/null 2>&1 

so I should have 938 rules in my firewall.
938 * 2=1876 + 1 = 1877 lines in the script (1 rule for delete rule
and one for add rule + rule at the top '#!/bin/sh')

but when adding this rules to the ipfw ruleset i have:
ipfw show 2000-2938 | wc -l

so somehere my 938-809=129 rules had just gone somewhere.
I'm using bash in here.. could that be a bug in bash ?

No, it's not a bash bug. In your script the order of commands is relevant. 'delete' has to be executed prior to 'add' for the same rule number. If you send each line into background separately there is no guaranteed execution order.

To fix this you need to remove the trailing ampersands from all the lines. And if you have to run this in background, send the whole script into background where you call it.

Uwe Doering         |  EscapeBox - Managed On-Demand UNIX Servers

[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to