Shell script for division of two numbers
1. initialize two variables
2. divide two numbers directly using $(...) or by using external program expr.
3. Echo the final result.
Division of two numbers without using expr
#Unix shell script for the division of two numbers num1=100 num2=20 ans=$((num1 / num2)) echo $ans
Output
5
Division of two numbers using expr in shell script
#Unix shell script for division of two numbers #using expr num1=100 num2=20 ans=`expr $num1 / $num2` echo $ans
Output
5
Useful Resources
To learn more shell script examples, you can visit the link