How you can use the bc command: 2-Minute Linux Tip

Hello, that is Sandra Henry-Stocker, creator of the “Unix as a Second Language” weblog on NetworkWorld.
On this Linux tip, we’re going to take a look at the bc command – it’s a command line calculator. To begin bc, you simply sort “bc”.
After a short heading, bc waits on your enter. You possibly can exit by typing “stop” or begin handing bc calculations that you really want it to carry out for you. Right here’s a simple subtraction:
Now, let’s get a little bit extra sophisticated:
The parenthesized half in that instance ensures that the subtraction is completed earlier than the multiplication. On this subsequent instance, we calculate each the sq. and the dice of 11.
You may also assign values to variables – useful if you wish to reuse a price with out having to reenter it.
You possibly can even resolve what number of decimal locations you wish to see in your outcomes.
That’s your Linux tip for the bc command.
If in case you have questions or want to recommend a subject, please add a remark under.
And don’t neglect to subscribe to the IDG Tech(discuss) channel on YouTube.
If you happen to appreciated this video, please hit the like and share buttons. For extra Linux suggestions, make sure to observe us on Fb, YouTube and NetworkWorld.com.

Supply

Germany Devoted Server

Leave a Reply