[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: >= and <= for string comparison
From: |
Kerin Millar |
Subject: |
Re: >= and <= for string comparison |
Date: |
Mon, 16 Jan 2023 21:38:05 +0000 |
On Mon, 16 Jan 2023 12:01:12 -0600
Peng Yu <pengyu.ut@gmail.com> wrote:
> string1 < string2
> True if string1 sorts before string2 lexicographically.
>
> string1 > string2
> True if string1 sorts after string2 lexicographically.
>
> According to the manual, >= and <= are not available for string
> comparison. But if >= and <= are available for arithmetic expression.
> Why >= and <= can not be introduced for string comparison? Currently,
> as a walkaround, I have to use > and = for >=, and < and = for <=. It
> is rather cumbersome to write bash code in this way.
This is not a response to the question itself but the penultimate sentence
isn't true. [[ ! str1 < str2 ]] and [[ ! str1 > str2 ]] would also do.
--
Kerin Millar
- >= and <= for string comparison, Peng Yu, 2023/01/16
- Re: >= and <= for string comparison,
Kerin Millar <=
- Re: >= and <= for string comparison, Peng Yu, 2023/01/16
- Re: >= and <= for string comparison, Ruiyang Peng, 2023/01/16
- Re: >= and <= for string comparison, Ruiyang Peng, 2023/01/16
- Re: >= and <= for string comparison, Peng Yu, 2023/01/16
- Re: >= and <= for string comparison, Ruiyang Peng, 2023/01/17
- Re: >= and <= for string comparison, Koichi Murase, 2023/01/17
- Re: >= and <= for string comparison, Ruiyang Peng, 2023/01/17
- Re: >= and <= for string comparison, Lawrence Velázquez, 2023/01/18
- Re: >= and <= for string comparison, alex xmb ratchev, 2023/01/18
- Re: >= and <= for string comparison, Lawrence Velázquez, 2023/01/18