24.11.2014 Views

General Information

General Information

General Information

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Description<br />

Some console commands are most useful if their output can be used as an argument value in other<br />

commands. In console, this is done by "returning" value from commands. Return value is not<br />

displayed on the screen. When you type such a command between square brackets '[' ']', this<br />

command is executed and it's return value is used as the value of these brackets. This is called<br />

command substitution.<br />

The commands that return usefull values are, but not limited to: find, /ping - returns the number of<br />

sucessful pings, time - returns the measured time value, incr and decr return the new value of a<br />

variable, add - return the internal number of newly created item.<br />

Example<br />

Consider the usage of find command:<br />

[admin@MikroTik] > /interface<br />

[admin@MikroTik] interface> find type=ether<br />

[admin@MikroTik] interface><br />

[admin@MikroTik] interface> :put [find type=ether]<br />

*1,*2<br />

[admin@MikroTik] interface><br />

This way you can see console internal numbers of items. Naturally, you can use them in other<br />

commands:<br />

[admin@MikroTik] interface> enable [find type=ether]<br />

[admin@MikroTik] interface><br />

Operators<br />

Description<br />

Console can do simple calculations with numbers, time values, ip addresses, strings and lists. It is<br />

achieved by writing expressions and putting them in parentheses '(' and ')'. The result of the<br />

expression serves as a return value for the parentheses.<br />

Command Description<br />

- - unary minus. Inverts given number value.<br />

- - binary minus. Substracts two numbers, two time values, two IP addresses or an IP address and a<br />

number<br />

! - logical NOT. Unary operator, which inverts given boolean value<br />

/ - division. Binary operator. Divides one number by another (gives number) or a time value by a<br />

number (gives time value).<br />

. - concatenation. Binary operator, concatenates two string or append one list to another or appends<br />

an element to a list.<br />

^ - bitwise XOR. The argumens and the result are both IP addresses<br />

~ - bit inversion. Unary operator, which inverts bits in IP address<br />

Page 525 of 568<br />

Copyright 1999-2005, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA.<br />

Other trademarks and registred trademarks mentioned herein are properties of their respective owners.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!