shell script for arithmatic operations
#!/bin/bash
a=10
b=5
val=`expr $a + $b`
echo "a+b=" $val
val=`expr $a - $b`
echo "a-b=" $val
val=`expr $a \* $b`
echo "a*b=" $val
val=`expr $a / $b`
echo "a/b=" $val
OUTPUT:
[root@domain30 mahesh]# vim arithmetic.sh
[root@domain30 mahesh]# sh arithmetic.sh
a+b= 15
a-b= 5
a*b= 50
a/b= 2
No comments:
Post a Comment