rajeshkumar created the topic: Write Script, using case statement to perform basic math operation as
Write Script, using case statement to perform basic math operation as
The name of script must be ‘q4’ which works as follows
$ ./q4 20 / 3, Also check for sufficient command line arguments
# Linux Shell Scripting Tutorial 1.05r3, Summer-2002
# Written by Vivek G. Gite
# Latest version can be found at http://www.nixcraft.com/
if test $# = 3
case $2 in
+) let z=$1+$3;;
-) let z=$1-$3;;
/) let z=$1/$3;;
x|X) let z=$1*$3;;
*) echo Warning - $2 invalied operator, only +,-,x,/ operator allowed
echo Answer is $z
echo "Usage - $0 value1 operator value2"
echo " Where, value1 and value2 are numeric values"
echo " operator can be +,-,/,x (For Multiplication)"
# ./ch.sh: vivek-tech.com to nixcraft.com referance converted using this tool
# See the tool at http://www.nixcraft.com/uniqlinuxfeatures/tools/
Twitt me @ twitter.com/RajeshKumarIn
- How to configure Elastic filebeat 8.3 with Elasticseach? - August 11, 2022
- How to Configure IP Network with ‘nmtui’ Tool - August 11, 2022
- Istio Tutorials: How to install & configure istio?￼ - August 11, 2022