Tuesday, July 8, 2008

Command based Calculator in BASH

Bash can perform simple arithmetic operations at the command prompt.

To use this feature, simply type in the arithmetic expression you wish to evaluate at the prompt within double parentheses, as illustrated below. Bash will attempt to perform the calculation and return the answer.


bash> echo $((16/2))
8


bash> echo $((16*2))
32

No comments: