Math Operations in shell scripting - Mod, division etc..

by RameshKumar 2010-01-23 14:56:59

To do math operation in shell scripting is very easy using both echo and bc commands

For example to fine mod of 5 and 3

echo 5%3 | bc


to find mod of two arguments

echo $1%$2 | bc


This will print the result of mod operators

Tagged in:

1314
like
0
dislike
0
mail
flag

You must LOGIN to add comments