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]
>
{:global
i
10;
:do
{:put
$i;
:set
i
($i
-
1);}
\
\...
while
(($i
<
11)
&&
($i
>
0));
:unset
i;}
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]
>
:local
A
"This
is
a
local
variable"
[admin@MikroTik]
>
:global
B
"This
is
a
global
one"
[admin@MikroTik]
>
:environment
Global
Variables
B=This
is
a
global
one
Local
Variables
A=This
is
a
local
variable
[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]
interface
pppoe-server>
:put
[:find
"13sdf1sdfss1sfsdf324333"
]
0
[admin@MikroTik]
interface
pppoe-server>
:put
[:find
"13sdf1sdfss1sfsdf324333"
3
]
1
[admin@MikroTik]
interface
pppoe-server>
:put
[:find
"13sdf1sdfss1sfsdf324333"
3
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
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]
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
5]
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.