Hi all.
I am new to the syntax/semantics of the Mikrotik scripting language.
I stumbled upon the Block access to specific websites script in the wiki.
I am willing to understand and not to blindly use it and the documentation seems not to be clear to me.
Very likely it’s my fault.
At line no.12 I read:
# if address list is empty do not check
:if ( [/ip firewall address-list find ] = "") ...
But I don’t understand how it works. Where is the name of the address list to be searched into?
If I execute those “find” sub-commands from command line I don’t get anything. For example
/ip dns cache find
doesn’t return anything, while from winbox I can see all the DNS cache items.
Any tutorial about this scripting language? The wiki has a manual that’s for people that already knows more than I do.
In your example, if ip firewall address-list is empty, then [/ip firewall address-list find ] will return nothing - “”, so conditions for:
:if ( [/ip firewall address-list find ] = “”) will be TRUE.
Find command won’t output any result to the terminal, to do so - use command
:put [/ip firewall address-list find ]
If you read the wiki script I linked, the address list is named “restricted” during insertion.
But then during the search the name of the address list is not mentioned at all!
So I don’t understand how can the script interpreter chose among the dozens of address-lists I have in the firewall configuration.
Or, to cut it short, which list is searched into by that find command?
P.S.
I already perused that Scripting manual but, surely my fault, I didn’t understand enough to answer myself.