A=100
B= $A+100
echo $B
What will the next line show?
a) 200 b)100100
If you answer b, then congratulation! But is there any way of making the answer a? Yes, there is. By using the keyword 'expr', the problem is solved. But how?
In the second line, instead of B=$A+100, change it to B=`expr $A + 100`. Remember the white spaces between the '$A', '+' and '100'. We can also use it for subtraction, comparison and other useful usage as well. You can either use the unix man expr, or click here for more information.
No comments:
Post a Comment