I am doing add operation as
#!/bin/sh
a=10
b=20
c='expr $a + $b'
echo "$c"
echo "$a"
echo "$b"
but it is showing output as
expr $a + $b
10
20
what is wrong with expr
Your example uses the wrong type of quotes:
a=10 b=20 c='expr $a + $b' echo "$c" echo "$a" echo "$b"
which should be (as a start):
a=10
b=20
c=`expr $a + $b`
echo "$c"
echo "$a"
echo "$b"
but more readable:
a=10
b=20
c=$(expr $a + $b)
echo "$c"
echo "$a"
echo "$b"
If you want to put all of those statements on a single line, separate them by semicolons:
a=10; b=20; c=$(expr $a + $b); echo "$c"; echo "$a"; echo "$b"
$() syntax Thomas showed here