Unic
1
Hi there,
I’am new to mikrotik scripting and i am not sure that i understand the “:” correct. Example:
This works:
:local wan1 “ether4”;
/interface ethernet;
set [ find default-name=“$wan1” ] comment=“$wan1” name=“wan1”;
and this not:
:local wan1 “ether4”;
/interface ethernet;
:set [ find default-name=“$wan1” ] comment=“$wan1” name=“wan1”;
only difference is “:set” and “set”.
Thanks for help!
2frogs
2
This
:local wan1 "ether4";
/interface ethernet;
set [ find default-name="$wan1" ] comment="$wan1" name="wan1";
Equals this
:local wan1 "ether4";
/interface ethernet set [ find default-name="$wan1" ] comment="$wan1" name="wan1";
The “set” command in this case is part of a Terminal Command which does not need the “:”.
A script command set would need the “:”, example..
:local wan1;
:set wan1 "ether4";
/interface ethernet set [ find default-name="$wan1" ] comment="$wan1" name="wan1";
The main reason to write the terminal command as you did would to set multiple variables under the same folder. example..
:local wan1 "ether4";
local wan2 "ether5;
/interface ethernet;
set [ find default-name="$wan1" ] comment="$wan1" name="wan1";
set [ find default-name="$wan2" ] comment="$wan2" name="wan2";
Unic
3
Hello,
and thank you very much for the detailed information. Now i understand the difference.