Answer the question
In order to leave comments, you need to log in
How to eat or not in Mikrotik?
Hello. How, upon completion of the script, to find out if there is such an IP, or if it does not exist.
the fact is that when the arp table has the ip address 192.168.5.2, then when executing this script, "est takoy ip" is written in the logs, but when it is not there, else does not work for some reason. why? Maybe the problem is in the wrong comparison
:if ($i != "") ?
:foreach i in=[/ip arp find address="192.168.5.2"]
do={:if ($i != "")
do={:log info message="est takoy ip"}
else={:log info message="net takoy ip"}}
Answer the question
In order to leave comments, you need to log in
Well, just look at the scripting on the mikrotik page, it is enough.
Here is an example if else
{
:local myBool true;
:if ($myBool = false) do={ :put "value is false" } else={ :put "value is true"
}
}
https://wiki.mikrotik.com/wiki/Manual%3AScripting
then we deduce that the value is false, otherwise we deduce the value is true.
"" != " " != NULL
Can you log the contents of the variable ??
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question