Closed wy16W2pIilK1xgqN closed 1 year ago
What is exponentiation operations?
File move is not supported by RouterOS. Use a SCP/SFTP client...
Sorry, didn't make it clear. I don't know English and use translation software to communicate with you.
The mathematical formula goes like this.
2⁴ = 16
2⁸ = 256
4⁴ = 256
This is true in linux bash.
root@archlinux:~# echo $[2**4]
16
root@archlinux:~# echo $[2**8]
256
root@archlinux:~# echo $[4**4]
256
You can use a simple function for that:
:global Exp do={
:if ($2 = 0) do={ :return 1; }
:local Return 1;
:for I from=1 to=$2 do={
:set Return ($Return * $1);
}
:return $Return;
}
... store it as script mod/exp
if you want to make it permanent.
To use the function:
[admin@MikroTik] > :put [ $Exp 2 4 ]
16
[admin@MikroTik] > :put [ $Exp 2 8 ]
256
[admin@MikroTik] > :put [ $Exp 4 4 ]
256
I do not have a use case for this in my scripts, so not adding.
Scripts lack the ability to exponentiation operations and file moves. Hope you can achieve it.