Why is there a "*" in front of the interface number

The following command logs the number of each of the interfaces and produces the output below:

:foreach k in=[/interface find] do={:log info $k}

Why is there a “*” in front of each number? It doesn’t appear to do any harm because this lists the names of the scripts:

:foreach k in=[/interface find] do={:log info [/interface get $k name]}

However, if you try this command you get an error “no such item”:

:log info [/interface get $1 name]
:foreach k in=[/interface find] do={:log info $k}

= for each interfae you find, put the “.id” on the log

:foreach k in=[/interface find] do={:log info [/interface get $k name]}

= for each interfae you find, put the interface name with the id “.id” on the log

:log info [/interface get $1 name]

= log the name of interface named same as “$1” variable

(and on this case “name” and $1 are the same thing, like “how is named John?”, the name is on the question…)

you must add something in the $1 var like:

:global 1 "ether1"

*1 = database entry ID on the database interface list


array of interface ID (the right name is “.id”)

:put [/interface find]

for example, if you do on CLI:

:put [/interface get *1]

you get something like:

.id=*1;actual-mtu=1500;default-name=ether1; ...etc...

You can use “name” of the interface for retrieve something:

:log info [/interface get ether1 disabled]

Or you can use the “.id”:

:log info [/interface get *1 disabled]

5 post in 20 minutes :slight_smile:
You know you can use the Edit button.

Mikrotik does not write why they add a * in front of an ID, but here you see some info.

https://wiki.mikrotik.com/wiki/Manual:Scripting

id (internal ID) - hexadecimal value prefixed by ‘*’ sign. Each menu item has assigned unique number - internal ID;

So that you’ll never confuse internal ids with temporary ids generated by console print.