can't disable rule using number from looping

hello, please help me.

I’ve tried to disable a lot of lines rule in /ip firewall mange using looping, but i got error message.

:for a from=0 to=4 do= {/ip fi mangle disable $a};
interrupted
           no such item

why i can’t do it?

thanks…

you have to print them first to assign them numbers. or you can use

/ip firewall mangle> print

/ip firewall mangle> set 11,12,13,14 disabled=yes

thank you for reply, but i still can’t disable rule by looping number.

The problem is that you have deleted an entry and that reorders things… try adding step=-1 to that loop so that you aren’t changing the order of things as it goes along.

oh, you arent deleteing, just disabling.. try this:

/ip firewall mangle print
:for a from=0 to=4 do={
/ip fi mangle set $a disable=yes
};

It would be cleanest not to use numbers at all. The item numbers are for people. For scripts you should use find commands to return the items you’re interested in, and then act on those. For example, set a comment of “thisOne” on items 0 through 4. Then you can use:

/ip firewall mangle { disable [find comment="thisOne"] };