I have a variable, defndata, which is a number (fetched from a file using awk).
I want that if defndata is not initialized (that is its not found in the file using awk), then to execute a block of statements, otherwise execute another block.
if [ "$defndata" -ne "" ]
then
....
else
...
fi
Now this statement is working fine if the value is not found, and defndata is blank.
However, if the value found is 0 (zero), its still treating it as a blank ("") and else condition block is being executed. If any other number is being found, it executes the first block (as expected).
I am not able to understand why?
Note: I am using ksh.