I'm trying to change my automatic backup script from RouterOS 6.x to 7.x to add the 'show-sensitive' parameter that's now required on ROS7. Previously, on ROS6, I would need to issue hide-sensitive if want to hide those informations. On ROS7, those informations are hidden by default and I need to ask for them (show-sensitive).
I tried to edit my backup script to get ROS major (6 or 7), and doing the export based on that, something like:
Code: Select all
:local ROSver value=[:tostr [/system resource get value-name=version]];
:local ROSmajor value=[:pick $ROSver 0 ([:find $ROSver "." -1]) ];
# ROSmajor will be only 6 or 7, 100% tested
:if ( $ROSmajor = 6 ) do={ /export terse file=$nomearquivo; } else={ /export terse show-sensitive file=$nomearquivo; }
On ROS6, however, the script gives an error and never runs, despite that 'else' will never be reached. Seems the script is being "compiled" or "analyzed" before run. And that being made, the 'show-sensitive' does not exist on ROS6, which triggers the error.
Question is: how could I acchieve a 'version-dependent' (based on ROS major) script, that would be exactly the same on ROS6 and ROS7, and yet do different things, being the commands on one ROS version maybe invalid on the other version? Is that possible?
Thanks for all your hints