How do I divide in the Linux console?

kman99 picture kman99 · Jul 6, 2009 · Viewed 103k times · Source

I have to variables and I want to find the value of one divided by the other. What commands should I use to do this?

Answer

dave4420 picture dave4420 · Jul 6, 2009

In the bash shell, surround arithmetic expressions with $(( ... ))

$ echo $(( 7 / 3 ))
2

Although I think you are limited to integers.