Friday, June 22, 2007
Double brackets for arithmetic operation
Suppose we have to increment the value of a variable
Normal way:
$ a=10; a=`expr $a + 2` ; echo $a
12
Can also be done this way:
$ a=10; ((a=a+2)); echo $a
12
Subscribe to:
Post Comments (Atom)
© Jadu Saikia www.UNIXCL.com
1 comment:
Or even:
a=10; ((a+=2)); echo $a
Post a Comment