Answer:
#! /usr/bin/bash
echo $[$1**$2]
Explanation:
(a) The first line of the code is very important as it tells the interpreter where the bash shell is located on the executing computer.
To get this on your computer, simply:
1. open your command line
2. type the following command: which bash
This will return the location where the bash shell is. In this case, it returned
/usr/bin/bash
(b) The second line is where the actual arithmetic takes place.
The variables $1 and $2 in the square bracket are the first and second arguments passed from the command line. The ** operator raises the left operand (in this case $1) to the power of the second operand (in this case $2).
Then, the echo statement prints out the result.
(c) Save this code in a file named as pow.sh then run it on the command line.
For example, if the following is run on the command line: ./pow.sh 2 3
Then,
the first argument which is 2 is stored in $1 and;
the second argument which is 3 is stored in $2.
The arithmetic operator (**) then performs the arithmetic 2^3 which gives 8.