Checking variable is numeric
Hi folks,
Basic question I assume. I need to check whether a shell script variable contains non-zero numeric data to proceed. The variable should contain numeric values, but may in fact contain zeroes, blank space or nothing. So far, I have tried various combinations of: Code:
if test $variable Thanks for any help. ijf |
Hello me,
I think I've found the answer: replaced if test $variable with: if test -n $variable and replaced: if test $variable -gt 0 with: if test $variable \> 0 Please let me know if anything unexpected may happen. (Thanks to they guy (Rinkel?) with the Advanced Bash-Scripting Guide in his sig!) ijf |
Several ideas here:
http://www.linuxquestions.org/questi...values-352226/ Check also the link in my signature about bash scripting. jlinkels |
All times are GMT -5. The time now is 02:46 AM. |