help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: >= and <= for string comparison


From: Greg Wooledge
Subject: Re: >= and <= for string comparison
Date: Wed, 18 Jan 2023 10:00:39 -0500

On Wed, Jan 18, 2023 at 03:54:02PM +0100, Emanuele Torre wrote:
> That would be wrong; [[ x < y || x = "y" ]]  and  [[ x > y || x = "y" ]]
> would be correct.

Am I the only person wondering when you would ever need this in a bash
script?  What's the goal here -- writing your own Bubble Sort from
scratch in one of the worst imaginable languages for it?  Even when
writing a comparison function for a sort routine, you only want the
swaps to happen when the strings are unequal -- never when they're equal,
since that would just be a waste of time.

Of course, given who the OP is, I know better than to ask "WAYTTD".  I'd
never, EVER get an answer from them.

But maybe someone else can think of a use case.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]