Technical Overview of Linux: Shell Mathematics and Logical Operations
In the shell environment, the following methods are supported for mathematical or logical operations. Using the expr command to perform mathematical or logical operations directly, such as<span><span>expr 2 + 2</span></span>. Using the bc command, data is piped into the bc command for calculations, for example<span><span>echo "scale=4; 3.44/5" | bc</span></span>. Using the<span><span>$ and $[operation]</span></span> format brackets … Read more