This turned out to be the correct answer, use the :execute command which does work with variables. So this is what i'm using in scriptsDoes :execute command exists in ROS6?
You try with it if does,Syntax will not be checked in string for execute, it will only break execute if is wrong syntax in it.Code::if ([/system package get 0 version] ~ "^6") do={:execute "/export terse" as-string} else={:execute "/export terse show-sensitive" as-string}
I'm using the following to get actual/major/minor revisions. This allows integer comparisons for specific changes such as 7.13+ wifi drivers
RouterOS = 7.13.3 (strips the " (Stable)")
RouterOSMajor = 7
RouterOSMinor = 13
Code:
:global RouterOS [:pick [/system resource get version] 0 [:find [/system resource get version] " "]]:global RouterOSMajor [:pick $RouterOS 0]{:local o:local a ([:find $RouterOS "."]+1):local b ([:find $RouterOS "." $a]):if ($b > 0) do={:set $o [:pick $RouterOS 0 $b]} else={:set $o $RouterOS}:global RouterOSMinor [:pick $o 2 [:len $o]]}
v6 or v7 commands...
Code:
:if ($RouterOSMajor > 6) do={:global C "/export terse"} else={:global C "/export terse show-sensitive"}execute $C ; /system script environment remove C
Code:
:if ($RouterOSMajor = 6) do={ :if ($RouterOSMinor <= 42) do={ :global C "/log warning \"RouterOS Insecure, Please Update\"" } :if ($RouterOSMinor > 42 and $RouterOSMinor <= 49) do={ :global C "/log warning \"Happy Days\"" } :if ($RouterOSMinor > 49) do={ :global C "/log warning \"Living in the future\"" }}:if ($RouterOSMajor = 7) do={ :global C "/log warning \"Still in beta testing, all new RB4011's are sad panda's\""}execute $C ; /system script environment remove C
Statistics: Posted by millenium7 — Mon Feb 05, 2024 2:22 am