|
From: | Bernd Eggink |
Subject: | Re: Comparison failure |
Date: | Thu, 10 Jan 2008 17:19:57 +0100 |
User-agent: | Thunderbird 2.0.0.9 (X11/20071031) |
Frans de Boer schrieb:
You where both right. It's the '<' versus -lt. I tend to avoid -lt because I always run into errors using this. Beside, in previous versions of Bash it did not give me this problem. But, i will give it a try in other functions to see if it works now everywhere as expected. And yes, the use of these comparison tokens is not well documented either. I have always read the documentation that they where interchangeable, which is clearly not the case.
Hm, 'man bash' clearly states in section "Conditional expressions" (that's what is included in [[ ... ]]):
string1 < string2True if string1 sorts before string2 lexicographically in the current locale.
arg1 OP arg2OP is one of -eq, -ne, -lt, -le, -gt, or -ge. These arithmetic binary operators return true if arg1 is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to arg2, respectively. Arg1 and arg2 may be positive or negative integers.
Personally, I like the bash documentation because it is complete and concise.
Greetings, Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de
[Prev in Thread] | Current Thread | [Next in Thread] |