Last active
May 22, 2016 10:48
-
-
Save jpluimers/9b239814e3b0aa5a3d0853efc02d9861 to your computer and use it in GitHub Desktop.
MikroTik RouterOS scripting: passing parameters a dollar at the end of the string requires parenthesis around the string. No need when initialising variables.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----------------------------start | |
value='^scripts.Function..*' | |
value='^scripts.Function..*$' | |
value='^scripts.Function..*$' | |
value='$' | |
value='$' | |
-----------------------------finish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
:local showValuesFromDirectInitilisation do={ | |
:local value1 "^scripts.Function..*" | |
:local logLine1 "value='$value1'" | |
:put $logLine1 | |
:local value2 "^scripts.Function..*\$" | |
:local logLine2 "value='$value2'" | |
:put $logLine2 | |
:local value3 ("^scripts.Function..*\$") | |
:local logLine3 "value='$value3'" | |
:put $logLine3 | |
:local value4 "\$" | |
:local logLine4 "value='$value4'" | |
:put $logLine4 | |
:local value5 ("\$") | |
:local logLine5 "value='$value5'" | |
:put $logLine5 | |
} | |
:put "-----------------------------start" | |
$showValuesFromDirectInitilisation | |
:put "-----------------------------finish" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# showValuesFromParameters | |
{ | |
:local showValue do={ | |
:local logLine "value='$value'" | |
:put $logLine | |
} | |
## fails each line that ends after \$" with a `syntax error (line 12 column 4)` (the line numbers vary) | |
:put "-----------------------------start" | |
$showValue value="^scripts.Function..*" | |
$showValue value="^scripts.Function..*\$" | |
$showValue value=("^scripts.Function..*\$") | |
$showValue value="\$" | |
$showValue value=("\$") | |
:put "-----------------------------finish" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----------------------------start | |
value='^scripts.Function..*' | |
value='^scripts.Function..*$' | |
value='$' | |
-----------------------------finish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# showValuesFromParameters | |
{ | |
:local showValue do={ | |
:local logLine "value='$value'" | |
:put $logLine | |
} | |
:put "-----------------------------start" | |
$showValue value="^scripts.Function..*" | |
$showValue value=("^scripts.Function..*\$") | |
$showValue value=("\$") | |
:put "-----------------------------finish" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----------------------------start | |
value='^scripts.Function..*' | |
value='^scripts.Function..*$' | |
value='^scripts.Function..*$' | |
value='$' | |
value='$' | |
-----------------------------finish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
:local showValuesFromSetInitilisation do={ | |
:local value | |
:local logLine | |
:set $value "^scripts.Function..*" | |
:set logLine "value='$value'" | |
:put $logLine | |
:set $value "^scripts.Function..*\$" | |
:set logLine "value='$value'" | |
:put $logLine | |
:set $value ("^scripts.Function..*\$") | |
:set logLine "value='$value'" | |
:put $logLine | |
:set $value "\$" | |
:set logLine "value='$value'" | |
:put $logLine | |
:set $value ("\$") | |
:set logLine "value='$value'" | |
:put $logLine | |
} | |
:put "-----------------------------start" | |
$showValuesFromSetInitilisation | |
:put "-----------------------------finish" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment