Thursday, January 20, 2011

Write Script with arithmetic Operations

#!/bin/sh
echo "enter two numbers"
read a b
c=$(($a+$b))
echo "$a + $b = $c"
# or
let c="$a+$b"
# or
c=`expr $a + 1`

echo "$a + $b is $c"
 



No comments:

Post a Comment