On Tue, Sep 09, 2025 at 00:10:55 -0600, Stan Marsh wrote:
> I suppose that what this thread is really about is how some desperate
> shell coders resorted to AWK to do floating point comparisons before
> there was the fltexpr loadable command.

Loadable builtins are not readily available on all platforms.  I *never*
recommend them as first tier solutions to any bash questions.  They
may come up as alternative solutions if the discussion drags on long
enough.

Since bash can't compare floating point numbers natively, it's quite
sensible to use awk to do it.  This is not even difficult.  What we need
to know is what the OP tried to do, and unfortunately that information
does not seem to be available.

For anyone who wants pointers on comparing floating point numbers in
bash scripts, I even have a FAQ page for it:
<https://mywiki.wooledge.org/BashFAQ/022>.  Sadly, the AI scrapers are
back to full strength this morning, so it might be difficult to load
the page.  If we're discussing crimes against humanity, THOSE are on
my list.

There's a static mirror at
<http://pgas.freeshell.org/mirror/wooledge/BashFAQ(2f)022.html>.

> Bash will exit on non-success exit code of the first awk statement,
> so the if statement will be incorrectly evaluated.

If bash is actually *exiting*, that implies that set -e may be in effect,
which opens up a whole new dimension of excitement.

This entire bug report might boil down to "I used set -e and didn't
understand the consequences".

Reply via email to