- Operators sometimes must be escaped using a backslash(\) to keep the command line from treating it as a special character.
- expr handles integers, not floating point values.
Using $(())
The $((expression)) construct is called arithmetic expansion.
- When using variables with arithmetic expansion, the '$' is not needed.
- The result is returned to the command line and will be interpreted as a command, unless embedded in another command.
The bc Command
If you need floating point values, rather than just integers, you may want to look at the bc command.
- Typing "bc" will put you into bc with several lines of introduction.
- Typing "bc -q" skips the introduction.
- Typing "quit" exits bc.