hi Unix gurus,
Pls consider the following piece of code
str='hello'
length=echo $str|wc -c
echo $length
y= ` expr \( 80 - $length \) `
echo $y
The last echo stmt is displaying 0 as the result.
If i put direct value like 6 instead of $length in i 3rd stmt it is giving the correct result.
I came to know that $length is not getting accessed inside of expr command.
Fine the above code is working.
But i wonder that ,why its not giving result,if we put parantheses.
we must to put parantheses in arithmetc expressions na.
suppose we have a long expression like 10 + 20 -30 + 40 *2 ,then will the above technique works