diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2010-12-13 21:56:50 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2010-12-13 21:56:50 +0100 |
commit | 6ccd5425b18e1f46a3ed64e92b4390ffddd7d7d4 (patch) | |
tree | 69c65c0dcd8c71686d24a83a7f8d30ed07683f72 | |
parent | 0dc0cdae77b2000052ddffc7eb95a646fa8fc6c8 (diff) |
Make sure math operators don't run on empty/unset variable
-rw-r--r-- | libui.sh | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -389,10 +389,10 @@ _dia_ask_number () then show_warning 'Invalid number input' "$ANSWER_NUMBER is not a number! try again." else - if [ -n "$3" -a $3 != '0' -a $ANSWER_NUMBER -gt $3 ] + if [ -n "$3" ] && [ $3 != '0' -a $ANSWER_NUMBER -gt $3 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is bigger then the maximum,$3! try again." - elif [ -n "$2" -a $ANSWER_NUMBER -lt $2 ] + elif [ -n "$2" ] && [ $ANSWER_NUMBER -lt $2 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is smaller then the minimum,$2! try again." else @@ -592,10 +592,10 @@ _cli_ask_number () then show_warning 'Invalid number input' "$ANSWER_NUMBER is not a number! try again." else - if [ -n "$3" -a $3 != '0' -a $ANSWER_NUMBER -gt $3 ] + if [ -n "$3" ] && [ $3 != '0' -a $ANSWER_NUMBER -gt $3 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is bigger then the maximum,$3! try again." - elif [ -n "$2" -a $ANSWER_NUMBER -lt $2 ] + elif [ -n "$2" ] && [ $ANSWER_NUMBER -lt $2 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is smaller then the minimum,$2! try again." else |