Use expr instead of $((...)) in shell scripts

For Solaris 10 compatibility.