expr command: z=`expr $z + 3` When Perl arrived, it became clear that such approach is inferior on modern computers and actually increases overhead of shell instead of decreasing it. So ksh93 was created to fight back the lost ground. While it failed to stop Perl, ksh93 was a big improvement, and later bash (starting from version 3.2) re-implemented most of the advanced features of ksh93 plus a couple of its own. Currently bash is restricted to integer arithmetic while ksh93 can do floating-point arithmetic as well. In bash version 3.2 and later you can (and should) use $(( )) or let ((...
Read full article from Arithmetic Expressions in BASH
No comments:
Post a Comment