I do not know how to install and where to install bc on windows
$ bash -help
GNU bash, version 4.4.23(1)-release-(x86_64-pc-msys)
$ bc
bash: bc: command not found
I use git-bash / mingw64 on windows.
please help
GIT Bash uses MINGW compilation of GNU tools. It uses only selected ones. You can install the whole distribution of the tools from https://www.msys2.org/ and run a command to install bc. And then copy some files to installation folder of Git. This is what you do:
Why do you even need bc
on a GIT bash?
A typical usage would be:
Prompt>echo $(1+2 | bc) // or something similar
Recently I've found out that double brackets do the thing, even without bc
:
Prompt>$ echo $((1+2))
Prompt>3
Edit after first comment
In case you need floating point calculations, you might use awk
, as in this example:
Prompt>awk 'BEGIN {print (20.0+5)/7}'
Prompt>3.57143
There are more examples under this URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With