Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 23620

Scripting • Re: ✂ Rextended Fragments of Snippets

$
0
0
I see that within your scripts you usually enter the configuration context and handle things there. Example:
Code:
/log[...]:foreach rlog in=[find where message~"((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])"] do={[...]

And I prefer to use the entire path of the command every time:
Code:
[...]:foreach rlog in=[/log find where message~"((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])"] do={[...]
What differences do you see in the two methodologies?
Is one better or worse? And why?
1) anything that reduces (not excessively) the code is fine

2) It is easier to correct a single line, if it changes the context as you wrote, rather than rewriting them all...

3) it is less heavy and more readable.

Statistics: Posted by rextended — Mon Apr 07, 2025 1:20 am



Viewing all articles
Browse latest Browse all 23620

Trending Articles