Possible Duplicate:
bash: $[<arithmetic-expression>] vs. $((<arithmetic-expression>))
The $(( expr )) construct can be used for integer math in bash, e.g.
echo $(( 2*2 + 1 )) # 5
$[ expr ] seems to do to do the same (but isn't documented):
echo $[ 2*2 + 1 ] # 5
Are these constructs equivalent in bash?
man bash says:
The format for arithmetic expansion is:
$((expression))The old format $[expression] is deprecated and will be removed in upcoming versions of bash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With