Add adresses with loop script

Hi all,

I have this script:

:for e from 101 to 150 do={
/ip address add address=(“10.150.” .$e .“.1/24”)
interface=($e)
}

When i run it thru terminal i get the error invalid value for argument address

Does anyone have a clue what i am doing wrong?

Thank you very much,

Your script works.

Do you have the correct name of your interfaces?.

I mean interface name 101,102,103…150 ?

Hi,

Yes these are vlan interfaces and are called 101, 102, 103 etcetera. When i enter the address by hand in the CLI it works:

[admin@MikroTik] > /ip address add address=10.150.101.1/24 interface=101
[admin@MikroTik] >

Hi.

I have test your script whit 3 interfaces and works

:for e from 101 to 103 do={
/ip address add address=("10.150." .$e .".1/24") \ 
interface=($e)
}

I tested vlan and bridge interface.

What RouterOs version do you have?, is it the latest?

This is strange. Yes i have upgraded to the latest version 6.39.2. Absolutely no clue why this is going wrong. I will reset and try again.

Thnx