On 12/09/10 12:25, James Bensley wrote:
Why does;
if [ "$1" -ge 128 -a -lt 192 ]
Error out with 'too many arguments', where have I gone wrong here?
dash says:
[: 6: -lt: unexpected operator
The problem is that -lt wants a integer on the left, and there isn't. So you want to repeat the $1:
if [ "$1" -ge 128 -a "$1" -lt 192 ]
Also I have in the mean time settled with;
if [ "$1" -ge 128 ]&& [ $1 -lt 192 ]
Is either one of these preferred over the other?
That is clearer to my eyes (but be consistent in your quoting of $1).
-- Martijn