Hello.
I’m puzzled with this because as I have read, global variables should be accessible from any script of a user. Meanwhile I can assign a global variable in script, read it from terminal, but cannot read it from another script. Also, the variable is not listed in system/script/environment, but I am able to read it.
Here’s the simplest proof :
[admin@Router] /system script> print
Flags: I - invalid
0 name="testput" owner="admin"
policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api
last-started=sep/16/2013 13:17:22 run-count=3 source=:put $testvar
1 name="testset" owner="admin"
policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api
last-started=sep/16/2013 13:17:19 run-count=4 source=:global testvar [/system clock get time]
[admin@Router] /system script> /system clock print
time: 13:19:09
date: sep/16/2013
time-zone-name: Europe/Warsaw
gmt-offset: +02:00
dst-active: yes
[admin@Router] /system script> run testset
[admin@Router] /system script> run testput
syntax error (line 1 column 7)
[admin@Router] /system script> environment print
# USER NAME VALUE
[admin@Router] /system script> /put $testvar
13:19:19
My problem is with syntax error everytime I try to read global variable.
This doesn’t happen when I set the var in the same script, with the same command as the other, so this is not an error in syntax. I have only one user.
Please help.
v6.1 on RB750GL