error in script for adding two numbers
hey ,
i have wrote a script to add two numbers which looks something like this x=10 y=10 z='expr $x + $y' echo $z according to me output should be 20 but output is coming expr $x + $y can someone help me in figuring out the problem thanks in advance |
You use the back tick, not the single quote. The back tick is on the key next to the 1 key.
Code:
x=10 Code:
x=10 |
You have to use backticks, not single quotes. Or the $(command) syntax if using bash. Or the arithmetic operator with double parentheses:
Code:
z=`expr $x + $y` |
thanx a lot......it starts working
|
All times are GMT -5. The time now is 12:03 PM. |