find name=$name
“find where name is identical to own name”
and obviously all interface have the name = to the interface $name itself…
*1;*2;*3;*4;*5;*6
A-B-C of programming: never use parameters names as variable names…
And the topic title, AS USUAL, since you don’t understand these things, it probably MUST be a bug on RouterOS, because it is impossible for you to be wrong.
Example of correct title: How works “find name=$name”?
This is comparing name property with its own value for each interface list iteration, since properties are mapped into variables with same name. In this case every condition matches and that’s why returns list of all interfaces. To see that execute:
/interface/find name=[:put $name]
and you will see that it will print name of each interface you have, doesn’t matter if name variable is previously set or not.
Not sure “reserved keywords” is the best explanation… I think of the CLI cmd’s properties as “inherited variables”, based what can be used in a set/get/find – so the list of them varies depending on the current CLI path/context. And these inherited variables are a “const” (read-only) local variable so they can’t be reassigned.
Exactly, correct term is reserved variable names not keywords (per command), as stated here https://wiki.mikrotik.com/wiki/Manual:Scripting#Reserved_variable_names. Variable with name as some of property names for command should not be used for that command, this is just for command scope, that variable still can be used out of command scope.
Parameter is part of command, you don't have ability to define/change them in code, it is part of syntax, while variable names you can. Field or property are defined named parts of data for certain entity (config. record). When you defining how something needs to be named it is about something that you can control in source which are in this case variable names.