Example use of case #Linux/Unix: Shell Programming – 001

Example Output:
10 * 1 = 10
10 * 2 = 20
10 * 3 = 30
10 * 4 = 40
10 * 5 = 50
10 * 6 = 60
10 * 7 = 70
10 * 8 = 80
10 * 9 = 90
10 * 10 = 100

———————————-

#!/bin/bash
multi()
{
clear
for ((i=1;i<=10;i++));
do
echo “$Y * $i = `expr $Y * $i`”
done
}

echo “Enter your Number”
read X

case “$X” in

1)

Y=1
multi
;;

2)

Y=2
multi
;;

3)

Y=3
multi
;;

4)

Y=4
multi
;;

5)

Y=5
multi
;;

6)

Y=6
multi
;;

7)

Y=7
multi
;;

8)

Y=8
multi
;;

9)

Y=9
multi
;;

10)

Y=10
multi
;;

esac
exit

 


 

Output

 

7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 = 35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70 From: http://sitestree.com/?p=12187
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:33:14

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