How to create a loop to add bridge with pre-defined configuration?

hi. i want to write a loop to create a bridge interface with defined name but not worked. where is problem?

#brnum is number of bridge that i want to create
:local brnum "2";
#brname is name of every bridge that i want defined from number 1 to brnum
:local brname1 "bridge-work";
:local brname2 "bridge-game";
#brcomm is comment of every bridge that i want defined from 1 to brnum
:local brcomm1 "work bridge";
:local brcomm2 " game bridge";
#now i want to write a loop
:for br from=1 to=($brnum) do={
/interface bridge;
add name=$brname$br comment=$brcomm$br arp=reply-only auto-mac=yes fast-forward=no mtu=1500}

second $ after first $ in $brname$br not accepted how to write this to mikrotik accept this and works without problem

Hello,

This shouldn’t be too difficult to do, do you need the bridge names to be dynamic some how or just a set name and comment for each? Reading your script you’ve already made I don’t see the need for scripting what could be a few lines of config though?

hi steve thanks for your reply. I want to set name and comment for each and i want to write public configuration script that no need to write a command for creating every bridge.
what should i do to resolve a problem?

No Way???! :frowning: :frowning: :frowning:
my question is one section on many section of configuration script that i write.my purpose to writing this script is that no need to write many lines and define all environment on first lines and loop sections are linked and connected together

Try this:

add name=($brname . $br) comment=($brcomm . $br) ...