S
S
Sergey c0re2018-12-06 16:46:44
Computer networks
Sergey c0re, 2018-12-06 16:46:44

Why is the global variable nullable??

Mikrotik hAP lite firmware 6.43.7 (but also on 6.40 which was the same by default)
if you set a variable in the terminal, for example

:global var1
:set var1 "X"

then everything is fine, it is in the environment variables.
everything is available from another terminal too.
and if you run the script from the terminal, then he sees it.
But if the script is run by the Run Script button from the Script List or by the scheduler, then this variable is always empty, even if it is set in the script!?
if in the script to make the following output
:global var1
:log info [:typeof $var1]

then, despite the fact that the variable was declared in the terminal, and even redefined in the script, every time it starts on this line it displays nothing !?
uh...
is that a kag???
How then to use global variables?
I need the script launched by the scheduler to see the global variable, how to pass it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey c0re, 2018-12-06
@erge

It has been experimentally established that the script must have the policy right,
then the variable appears in the environment
i.e. in total:
read, write, test, policy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question