The commands that produce return values are, but not limited to: find, which returns a reference to
a particular item, ping, which returns the number of sucessful pings, time, which returns the
measured time value, incr and decr, which return the new value of a variable, and add, which
returns the internal number of newly created item.
Example
Consider the usage of find command:
[admin@MikroTik] > /interface
[admin@MikroTik] interface> find type=ether
[admin@MikroTik] interface>
[admin@MikroTik] interface> :put [find type=ether]
*1,*2
[admin@MikroTik] interface>
This way you can see internal console numbers of items. Naturally, you can use them as arguments
in other commands:
[admin@MikroTik] interface> enable [find type=ether]
[admin@MikroTik] interface>
Operators
Description
RouterOS console can do simple calculations with numbers, time values, IP addresses, strings and
lists. To get result from an expression with operators, enclose it in parentheses '(' and ')'. The
expression result serves as a return value for the parentheses.
Command Description
- - unary minus. Inverts given number value.
- - binary minus. Substracts two numbers, two time values, two IP addresses or an IP address and a
number
! - logical NOT. Unary operator, which inverts given boolean value
/ - division. Binary operator. Divides one number by another (gives number) or a time value by a
number (gives time value).
. - concatenation. Binary operator, concatenates two string or append one list to another or appends
an element to a list.
^ - bitwise XOR. The argumens and the result are both IP addresses
~ - bit inversion. Unary operator, which inverts bits in IP address
* - multiplication. Binary operator, which can multiply two numbers or a time value by a number.
& - bitwise AND The argumens and the result are both IP addresses
&& - logical AND. Binary operator. The argumens and the result are both logical values
+ - binary plus. Adds two numbers, two time values or a number and an IP address.
< - less. Binary operator which compares two numbers, two time values or two IP addresses.
Returns boolean value
Page 635 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.