Hello,
I’m just starting scripting in mikrotikOS and I have some problem in one of my script when I try to enable/disable some route.
if I use this code :
:local test ;
:set test 4 ;
:ip route enable $test ;
it didn’t work and mikrotik message is “no such item” like if I didn’t have a 4th route.
but if instead i do
:ip route enable 4 ;
it work.
I’ve try to use global variable instead of local one but it didn’t change anything.
environment print confirm that the variable test is equal to 4.
I’ve search on the forum/wiki but I didn’t find anything about it so If anyone have an idea of what happening it would really help me.
thank you.
Are you issue commands from CLI ?
If yes, then you should remember that each command is single entity which “forgets” all changes to the environment.
Try to “pack” your code in { … } block as code block prevents “forgetting”. You can also put your code into script for test.
ok, thank you.
I assume that it is to be sure that you have the right route and it work so it’s perfect for me but I’m still curious of why it didn’t work before. is it that the variable are interpreted as string even with a number into it ?