MikroTik RouterOS v2.9 Reference Manual page 654

Reference manual
Table of Contents

Advertisement

before doing anything else, and if it is false then no action is taken ( text ) - actions to execute
repeatedly ( yes | no ) - condition, which is evaluated each time after the execution of enclosed
statements ( yes | no ) - condition, which is evaluated once before the execution of enclosed
statements
[admin@MikroTik]
\...
while
10
9
8
7
6
5
4
3
2
1
[admin@MikroTik] >
environment print - prints information about variables that are currently initialised. All global
variables in the system are listed under the heading Global Variables. All variables that are
introduced in the current script (variables introduced by :local or created by :for or :foreach
statements) are listed under the heading Local Variables.
Creating variables and displaying a list of them
[admin@MikroTik]
[admin@MikroTik]
[admin@MikroTik]
Global
B=This
Local
A=This
[admin@MikroTik] >
find - searches for substring inside a string or for an element with particular value inside an array,
depending on argument types and returns position at which the value is found. The elements in list
and characters in string are numbered from 0 upwards ( text | ) - the string or value list the search
will be performed in ( text ) - value to be searched for ( integer ) - position after which the search is
started
[admin@MikroTik]
0
[admin@MikroTik] interface pppoe-server> :put [:find "13sdf1sdfss1sfsdf324333" 3
1
[admin@MikroTik] interface pppoe-server> :put [:find "13sdf1sdfss1sfsdf324333" 3
17
[admin@MikroTik] interface pppoe-server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3"
3
4
[admin@MikroTik] interface pppoe-server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3"
3
4
[admin@MikroTik] interface pppoe-server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3"
3
5
[admin@MikroTik] interface pppoe-server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3"
3
15
[admin@MikroTik]
for - executes supplied commands over a given number of iterations, which is explicity set through
from and to parameters ( name ) - the name of the loop counter variable ( integer ) - start value of
the loop counter variable ( integer ) - end value of the loop counter variable ( integer ; default: 1 ) -
increment value. Depending on the loop counter variable start and end values, step parameter can be
treated also as decrement ( text ) - contains the command to be executed repeatedly
Page 640 of 695
Copyright 1999-2007, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA.
Other trademarks and registred trademarks mentioned herein are properties of their respective owners.
>
{:global
i
(($i
<
11)
>
:local
>
:global
>
is
is
interface
pppoe-server>
10;
:do
{:put
&&
($i
A
"This
B
"This
:environment
a
a
:put
[:find
$i;
:set
i
($i
>
0));
is
a
local
is
a
global
global
local
"13sdf1sdfss1sfsdf324333"
-
1);}
\
:unset
i;}
variable"
one"
print
Variables
one
Variables
variable
]
]
3]
]
3]
4]
5]

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents