Please use [code][/code]
tags around your code and data, to preserve formatting and to improve readability. Please do not use quote tags, colors, or other fancy formatting.
Your test lines are completely broken:
" is a command, and the shell must parse the arguments following the command by reading whitespace. You have no whitespace, so the command breaks.
2) QUOTE ALL OF YOUR VARIABLE SUBSTITUTIONS
. You should never leave the quotes off a variable expansion unless you explicitly want the resulting string to be word-broken by the shell. This is particularly important inside the "[
" test brackets, as the wrong number of arguments will break the comparison.
" is not a valid comparator. You need to use "-ge
" for numerical comparisons.
However, since you're using bash, you really should avoid using "[
" altogether, and use the newer "[[..]]
" for string tests and "((..))
" for arithmetic tests.
So I recommend changing the above to: