The issue is that a word that appears like a file redirection in a shell test or comparison will be interpreted as such, rather than as a comparison. To avoid this, escape the potential redirection operator or use the appropriate comparison operators.