Q.1.
How to write shell script that will add two nos, which are supplied as command
line argument, and if this two nos are not given show error and its usage
A.
#
#
#
#
#
#
#
#
#
#!/bin/bash
Linux Shell Scripting Tutorial 1.05r3, Summer-2002
Written by Vivek G. Gite <vivek@[Link]>
Latest version can be found at [Link]
[Link] to sum to nos
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`"
#