[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] simple math in bash



> > I can't remember how to do simple math in bash.  I used to know but I cant find
> 
> 	Don't know whether there is an easier way, but, I have always 
> used "dc" to do math in shell scripts. Ex, adding 1 + 1 would be:
> 
> echo "1 1 + p q" | dc

I either use bc (interactively) or expr.

	E.g. $ expr 1 + 1

Spang!

---
Christopher Hamilton            Internal System Administrator
chrish at ifsintl.com              IFS International, Inc.