Arithmetic Operations using two variables #Linux/Unix: Shell Programming – 001

#!/bin/sh

#will do addition, subtraction, multiplication, and division of two variables
X=12
Y=5

#print the values of the variables
echo “X value is: “$X
echo “Y value is: “$Y

#addition
echo “X + Y” = `expr $X + $Y`

#subtraction
echo “Y – X” = `expr $Y – $X`

#multiplication
echo “X * Y” = `expr $X * $Y`

#division
echo “X / Y” = `expr $X / $Y”`

????? – Output

bash-3.2$ ./arithmetics-operations-of-variables.sh
X value is: 12
Y value is: 5
X + Y = 17
Y – X = -7
X * Y = 60
X / Y = 2 From: http://sitestree.com/?p=12179
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:11:48

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada