yes, return as soon as possible, when you know it is not valid.
But unfortunately:
Code:
a="adfgarfg"
(( a >= 0 )) && echo ok
(( a <= 255 )) && echo ok
It won't work for non-numerical inputs and also may produce strange results (for example if a="12w")
bash is not really good at it.