amcrs
April 23, 2021, 3:51am
1
I have
:global eruWAN ether1
/ip firewall filter add chain=forward out-interface=!($eruWAN) …
which the CLI doesn’t like. Nor
/ip firewall filter add chain=forward out-interface=!$eruWAN …
/ip firewall filter add chain=forward out-interface=(!$eruWAN) returns “Script Error: cannot logically negate string” which makes sense, but
/ip firewall filter add chain=forward out-interface=!ether1 … works.
How can I use the variable $eruWAN there?
Jotne
April 23, 2021, 9:18am
2
In cli wrap the code i brackets. {code}
{
:global eruWAN ether1
/ip firewall filter add chain=forward out-interface=!($eruWAN) ....
}
mrz
April 23, 2021, 9:31am
3
As error says you cannot logically negate string.
by specifying !“string” you are trying to perform logic operation on string and then apply it as a value.
To pass ! as part of the value you should pass it as a part of string “!$your_var”
[admin@MikroTik] /ip/firewall/filter> add out-interface="!$x" chain=xx
[admin@MikroTik] /ip/firewall/filter> print
Flags: X - disabled, I - invalid; D - dynamic
0 chain=xx out-interface=!ether1
do not matter, if you use GLOBAL, instead of local.
As error says you cannot logically negate string.
by specifying !“string” you are trying to perform logic operation on string and then apply it as a value.
To pass ! as part of the value you should pass it as a part of string “!$your_var”
[admin@MikroTik] /ip/firewall/filter> add out-interface="!$x" chain=xx
[admin@MikroTik] /ip/firewall/filter> print
Flags: X - disabled, I - invalid; D - dynamic
0 chain=xx out-interface=!ether1
sorry.. missing
:global x "ether1"
[admin@MikroTik] /ip/firewall/filter> :global x "ether1"
[admin@MikroTik] /ip/firewall/filter> add out-interface="!$x" chain=xx
[admin@MikroTik] /ip/firewall/filter> print
Flags: X - disabled, I - invalid; D - dynamic
0 chain=xx out-interface=!ether1