June 2017
Beginner
502 pages
11h 26m
English
As we saw at school, exponentiation is a number multiplied by itself as many times as imposed by the exponent:
zarrelli:~$ a=4 ; b=5 ; c=$((a**b)) ; echo ${c}1024 zarrelli:~$ a=4 ; c=$((a*a*a*a*a)) ; echo ${c}1024
In this case, we are facing a left-associative operation and the order matters. Be aware that, in any case, the variables are expanded before the evaluation takes place with all the operators we have seen so far. We are using both $a and${a} to get you used to what you will face in real life, looking at the scripts you will find on the Internet.
Read now
Unlock full access