By: Vivek G Viewed: 701 times Printer Friendly Format
This shell script shows how to accept command line arguments in shell scripts. In this example it accepts two numbers and adds them.
if [ $# -ne 2 ] then echo "Usage - $0 x y" echo " Where x and y are two nos for which I will print sum" exit 1 fi echo "Sum of $1 and $2 is `expr $1 + $2`"
Most Viewed Articles (in Linux )
Latest Articles (in Linux)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews