>can't do floating point arithmetic. >needs to pipe to bc

>can't do floating point arithmetic
>needs to pipe to bc
Why did they design like this
This is not an UNIX shell from the 70's, this is a modern language

Black Rifle Cuck Company, Conservative Humor Shirt $21.68

Yakub: World's Greatest Dad Shirt $21.68

Black Rifle Cuck Company, Conservative Humor Shirt $21.68

  1. 6 days ago
    Anonymous

    its an os scripting language.
    expecting it to do FPA is like wanting to use JS for OSdev

    • 6 days ago
      Anonymous

      Forth can do FPA, this has no excuse

      • 6 days ago
        Anonymous

        >forth compiled
        its a completely different class of language
        with completely different design considerations.

        bash is all about manipulating strings

        • 6 days ago
          Anonymous

          Bash is a scripting and command language primarily used for automating system tasks. FORTH is a procedural programming language, usually used with a compiler and IDE, for the purpose of building standalone applications. You are a Black person.

          Almost all interpreted languages I can think about have FPA, why cant bash

          • 6 days ago
            Anonymous

            different design considerations.
            bash is all about manipulating strings

      • 6 days ago
        Anonymous

        Bash is a scripting and command language primarily used for automating system tasks. FORTH is a procedural programming language, usually used with a compiler and IDE, for the purpose of building standalone applications. You are a Black person.

        • 6 days ago
          Anonymous

          >forth compiled
          its a completely different class of language
          with completely different design considerations.

          bash is all about manipulating strings

          Forth is not "compiled" - it is not a statically typed language.
          In fact, Forth has no types.
          On modern register machines, you would need to emulate need to emulate a stack machine. That's it.
          Forth is just an elegant asm for stack machines. 100% typeless and dynamic.

          • 6 days ago
            Anonymous

            >forth
            now thats some turbo autism

    • 6 days ago
      Anonymous

      zsh has floating point arithmetic. i had forgotton that bash doesn't.

      its not a scripting language, its a shell which can be scripted or used for scripting. in 1979, the bourne shell was the unix user interface. bash started as a gnu clone then extended bourne sh. lack of floating point math is like your phone not coming with a calculator app.

      • 6 days ago
        Anonymous

        lol what an autist
        youre the only one bothered by that
        just extend the language if it irks you that much

      • 6 days ago
        Anonymous

        We can pipe to awk or bc, which are standard on 100% of GNU/Linux distributions.

  2. 6 days ago
    Anonymous

    I found a big memory bug in bash yesterday.
    No, I won't report it.

  3. 6 days ago
    Anonymous

    Just use perl or python?

  4. 6 days ago
    Anonymous

    The main point of a shell is to be an interface to other programs. Having to use bc for actual math isn't unusual.
    If you really insist on doing floating point math in a shell, I think zsh and fish support it.

    • 6 days ago
      Anonymous

      yeah zsh has it i use it all the time to get math results without copy and pasting or retyping a cli result into a calculator

  5. 6 days ago
    Anonymous

    Give me a single use case for floating point arithmetic in bash.
    Just one.

    • 6 days ago
      Anonymous

      When your game reaches gold you are supposed to have a 1.0 version, so you need to floats to handle updates like 0.9 + 0.1 = 1.0

      • 6 days ago
        Anonymous

        >you need to floats to handle
        ESLtard opinion discarded
        learn to english first

        • 6 days ago
          Anonymous

          I'm dislexyc you racist.

      • 6 days ago
        Anonymous

        version numbers should be treated as independent numbers concatenated with '.' delimiters.
        i guess you could be the one weird person to release a game using bash and have floating point version numbers. art points i guess

    • 6 days ago
      Anonymous

      I have a bash script that controls the fans in my server. I do the pipe-to-bc stuff so I get proper round-to-nearest instead of truncate-to-integer for turning a "zero to 100% speed" into a "20-something to 255 value I can echo to a device in hwmon" and for scaling how fast the values I set go up with increasing temperature.

  6. 6 days ago
    Anonymous

    bc does arbitrary precision math and accompanies the shell everywhere
    why reinvent the wheel?

  7. 6 days ago
    Anonymous

    It can:
    https://github.com/clarity20/shellmath
    https://manpages.org/awk
    https://manpages.org/bc

  8. 6 days ago
    Anonymous

    shell-weenies when they spend spend 90% of their time writing scripts serializing and de-serializing text data in a dodgy way (g*d forbid something changes positionally later) piping it through 2 or 3 different line editors (awk sed tr cut grep etc. each with their own 1-3 different specialboy regex implementations):
    >json is bloated

    • 6 days ago
      Anonymous

      >what is jq

    • 6 days ago
      Anonymous

      gron file.json | grep -Ei "(ni|fa)gg(er|ot)"
      what now json-boy

      • 6 days ago
        Anonymous

        gayger
        Niggot

    • 6 days ago
      Anonymous

      things only change out of nowhere when you use troon software (web, rust, etc)

    • 6 days ago
      Anonymous

      >unix philosophy: let's treat everything as plain text, and then make sure that string manipulation in your shell is a kludgy horrible mess
      powershell chads rise up.

  9. 6 days ago
    Anonymous

    [...]

    what a lad

    The main point of a shell is to be an interface to other programs. Having to use bc for actual math isn't unusual.
    If you really insist on doing floating point math in a shell, I think zsh and fish support it.

    This. Commands are bricks, the shell is the mortar.

    It can:
    https://github.com/clarity20/shellmath
    https://manpages.org/awk
    https://manpages.org/bc

    bc and awk are their own programs, not shell built-ins of Bash. awk is even Turing-complete.
    That's like saying my shell can display images because I can open a jpeg in chafa. The shell itself is not doing any of the work.

Your email address will not be published. Required fields are marked *