LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Syntax for performing bash simple math calculations (https://www.linuxquestions.org/questions/linux-general-1/syntax-for-performing-bash-simple-math-calculations-430490/)

kinetik 03-31-2006 07:26 PM

Syntax for performing bash simple math calculations
 
Hi all


I saw this somewhere, but can't remember where... What's the correct syntax for performing simple bash math calculations?

For instance, I just want to dive 105 by 7, what should I write?

homey 03-31-2006 07:50 PM

Did you mean something like echo $((105 / 7)) or are you thinking of using bc ?

stingrayon 03-31-2006 07:52 PM

Try the bc command. It is a powerful calculator available on the command line.


For example you can do the following:

bc <return>
3+4 <return>
7


For a more extensive documentation try "man bc".

---
Stingrayon.

kinetik 03-31-2006 08:03 PM

Stingrayon, Homey, thanks alot for your help! :D


All times are GMT -5. The time now is 02:46 AM.