Global variable not working between two scripts

Hello, guys.

Im trying to develop two scripts:

script1:

  • Declare a global variable;
    Set its value;
    call script2;

script2:

  • Set a route filter’s action to discard, finding this filter using the value of the global variable;

The script1 correctly calls the script2, but the script2 does not change the filter’s action.
Please, could someone help me?

Below the exported scripts and the screenshot attached!


/system script
add name=script1 owner=damito policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=
“:global xpto\r
\n:set xpto "whatever" \r
\n/system script run script2”
add name=script2 owner=damito policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=
“/routing filter set action=discard [/routing filter find where chain=$xpto];”

You need to declare the global variable in the second script as well.

It worked, thank you :wink: