BASH Tip: Alternative to expr for arithmetic

I discovered recently a neat way to do arithmetic in BASH without the need to use the expr command. There's a build-in that uses the syntax $((…)) or $[ … ]. This is also faster as it avoids the need to invoke a separate command. See: http://snap.nlc.dcccd.edu for more on the rules pertaining to this syntax.

Show Comments