Sometimes in my small shell script i've to do some math, usually nothing too complex but it's useful to do the math inside the bash script. Bash it's really complete and among the many builtin functions there are also some mathematical functions. Using the syntax $((expression)) you can evaluate the expression. Operations allowed are quite a few. From  man bash: ARITHMETIC EVALUATION The shell allows arithmetic expressions to be evaluated, under certain circumstances. Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. The operators and their precedence, asso ciativity, and values are the same as in the C language. A volte, nei miei piccoli shell script che faccio, utilizzo un po' di matematica, di solito niente di troppo complesso, ma è utile fare i conti all'interno dello stesso script bash. Bash è davvero completa e tra le molte funzioni incluse ci sono anche alcune funzioni matematiche. Utilizzando la si More