bash bug or something else?

From: hugle (hugle_at_vkt.lt)
Date: 12/17/03

  • Next message: Matthew Seaman: "Re: Windows client - internet connection sharing"
    Date: Tue, 16 Dec 2003 17:07:25 -0800
    To: freebsd-questions@freebsd.org
    
    

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

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

    cat bin/users:
    #!/bin/sh
    /sbin/ipfw -q delete 2001 >/dev/null 2>&1 &
    /sbin/ipfw -q add 2001 count ip from 192.168.0.1 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 192.168.0.1 out via fxp0 >/dev/null 2>&1 &
    /sbin/ipfw -q delete 2003 >/dev/null 2>&1 &
    /sbin/ipfw -q add 2003 count ip from 192.168.0.111 to not me in via fxp0 >/dev/null 2>&1 &
    /sbin/ipfw -q delete 2004 >/dev/null 2>&1 &
    /sbin/ipfw -q add 2004 count ip from not me to 192.168.0.111 out via fxp0 >/dev/null 2>&1 &
    *****
    ****
    *****
    ****
    ****
    ****
    /sbin/ipfw -q add 2935 count ip from 192.168.5.63 to not me in via fxp0 >/dev/null 2>&1 &
    /sbin/ipfw -q delete 2936 >/dev/null 2>&1 &
    /sbin/ipfw -q add 2936 count ip from not me to 192.168.5.63 out via fxp0 >/dev/null 2>&1 &
    /sbin/ipfw -q delete 2937 >/dev/null 2>&1 &
    /sbin/ipfw -q add 2937 count ip from 192.168.5.99 to not me in via fxp0 >/dev/null 2>&1 &
    /sbin/ipfw -q delete 2938 >/dev/null 2>&1 &
    /sbin/ipfw -q add 2938 count ip from not me to 192.168.5.99 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
         809

    so somehere my 938-809=129 rules had just gone somewhere.
    I'm using bash in here.. could that be a bug in bash ?
    bash --version
    GNU bash, version 2.05b.0(1)-release (i386-portbld-freebsd4.9)

    btw, when i look into ipfw and can't find some rules in it..
    for example there goes
    rule nr 2001,2002,2003,2004,2005,2008 so i have no rule with number
    2006 and 2007 but they exist in my script.

    after running this script other time i got
    ipfw show 2000-2938 | wc -l
         814
    one more time :

    ipfw show 2000-2938 | wc -l
         836

    But I have not changed anything in my script.

    -- 
    Best regards,Hugle
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
    

  • Next message: Matthew Seaman: "Re: Windows client - internet connection sharing"

    Relevant Pages

    • Re: my lame attempt at a shell script...
      ... I don't know if you're on 5.x, nor whether you use ipfw, ipfilter or pf ... Create your script and load rc.subr: ... bash is available when your script run. ...
      (freebsd-questions)
    • Re: [ Attn: Randy ] Ad-hoc Parsing?
      ... > 1) They were out of context quotes, as the quotes came with no context. ... embed cpu instructions within a DOS/Windows batch script. ... that this also is possible with bash scripts. ... statement "It can execute the .com file as easily as a command.com ...
      (alt.lang.asm)
    • Re: [opensuse] Editting PATH variable
      ... SuSEconfig script ... ... not knowing what you options you used to install ... If your unfamiliar with Bash a good book is 'Learning the Bash Shell' by ... For Java use editing the PATH variable is NOT required... ...
      (SuSE)
    • Re: Command Line Interface
      ... >> should accept system commands only for an administrator. ... >> how should I supress the bash shell and launch my custom CLI ... > The script could run in a restricted shell and offer a menu of ... account, and either 1) change account password, 2) ...
      (comp.os.linux.misc)
    • Re: Reverse ldd ??
      ... people don't use them and that bash is what everyone does use, ... learning a new language in order to recode a snippet. ... then you will quickly recognize what the tclshell script ... I just am saying that's what I found confusing. ...
      (comp.os.linux.misc)