Quote:
Originally Posted by SIRSteiner
Yes, but shell variables are always saved as string.
Regards
|
In this case they are. The sh_ivtool.app program is outputting string data to stdout.
Besides, numbers are only allowed to be integers in shell scripts, so trying to assign a floating point number like 2.9 to an integer wouldn't have worked right anyway. You should either handle the mantissa and the fractional parts separately, or use something like
awk to deal with floating point numbers.
paolog, to make your code more bulletproof, you should be testing the return code of sh_ivtool.app before using the output. It's possible that someone can just hit the escape button in the middle of the dialog and it won't be outputting any proper string. So, as in the README.txt file:
Code:
NUM=`sh_ivtool -n "Enter a number:"`
if [ $? -eq 0 ]; then
if [ "$NUM" > "0" ]; then
echo It's bigger than 0!
fi
fi
or, more concisely:
Code:
NUM=`sh_ivtool -n "Enter a number:"`
if [ $? -eq 0 -a "$NUM" > "0" ]; then
echo It's bigger than 0!
fi