Page 1 of 1

[possible bug] interface id from variable is different

Posted: Thu Aug 03, 2017 4:58 pm
by DeCr0pt
Hello, i have simple script :local getid [/interface get [find name=ether2] id] normally when i check it via /interface print i see id 1 but when i make :put $getid i got id 6, of course i can use something like a ($getid -5) but i dont want use it because on my testing CHR is this working fine, what it is? I m using latest 6.40 of routeros

Re: [possible bug] interface id from variable is different

Posted: Thu Aug 03, 2017 9:37 pm
by msatter
Number one is the position in the list and ID is the hexadecimal location of the real position in the list. So you have different vectors for the same line.

Re: [possible bug] interface id from variable is different

Posted: Thu Aug 03, 2017 10:00 pm
by DeCr0pt
Thanks for info, and how i can get number of position in list? Is possible to use like in unix system /interface print | grep ether2 | awk '{print $1}' ?

Re: [possible bug] interface id from variable is different

Posted: Fri Aug 04, 2017 11:40 am
by msatter
I was wrong on this and I was looking at the general ID and this one is specific for interfaces.

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

Re: [possible bug] interface id from variable is different

Posted: Fri Aug 04, 2017 12:49 pm
by DeCr0pt
I rewrite my script to work just only with name of interface, but it will be good to have something to grep id of interface via get. But thanks anyway