Bash tips


I read through the bash tips on the hacktux website, which brought to light the fact that you can do basic integer math in your bash scripts. This is easily accomplished by using dual parenthesis similar to this:

four=$(( 2 + 2 ))
echo $four

This is good stuff, and I need to replace some old bc ... and expr .. statements with this.

This article was posted by Matty on 2009-02-17 15:04:00 -0400 -0400