Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

17
  • 1
    That is a Here String. (From the manual:) <<<word is expanded and supplied to the command on its standard input. Shorter than echo ... |. Commented Jun 14, 2012 at 15:14
  • 2
    As a variation on the bc approach, I added the following function (that I found on stackexchange somewhere) to my .bashrc file. I can just enter calc 2+3 and get 5. ## Command line calculator calc () { bc -l <<< "$@" } Commented Jun 16, 2012 at 18:59
  • 1
    sugest you removing bc without scale configuration as bc without scaling doesn't perform division correctly (it rounds floor), so bc <<< 20+5/2 = fail Commented Jan 31, 2017 at 15:56
  • 1
    @Chris, fish is a moving target. They're working on their new math builtin (or whatever it's called now) as we speak. Feel free to edit. It's not my answer and it's community wiki. Commented Dec 20, 2017 at 21:18
  • 1
    (Saying that kinda makes me think I should go through the whole list, and besides it would be nice to have them all spell out the same expression... but I don't think I can be bothered right now. ) Commented May 22, 2022 at 21:02