Addition of two variables in shell script
1. initialize two variables
2. Add two variables directly using $(...) or by using external program expr
3. Echo the final result.
- Code:
num1=20
num2=10 #Don't Give between space
sum=` expr $num1 + $num2 `
echo "Sum Of Two Numbers : $sum"
- Output:
- Click For Image View------
sum of two numbers in shell |
🙏THANKS FOR VISIT🙏
Addition of two variables in shell script - CodexRitik
Reviewed by CodexRitik
on
July 11, 2020
Rating:
No comments: