I cannot solve question 3 in arithmetic operations and even saw the answer in the directory but unable to resolve it. Please help me with this.
Hello @Pj1017
Please try to follow these steps:
1- use the vi editor to create the script with the specified path:
$ vi /home/bob/calculate-price.sh
2- The content should be as followed since it must accept 2 parameters that would be multiplied and print in the output for example (The total price for items is 1000 dollars)
For that reason we have used $1 and $2 for the input arguments and the product is stored in the variable “price” then to print it we have used “echo” function
Find below the script, you can write it using the editor
price=$(( $1 * $2 ))
echo “The total price for items is ${price} dollars”
3- ESC
4- :wq
to save the file
Hope this helps!