beer9
asked on
Difference of (( )) and $(( )) in bash script
Hello, While going through reading some bash tutorial I am stuck here..
I am not able to get where should I use (( )) and $(( )). Could someone please provide me an example to understand it better. Thanks!
(( )) Evaluates and assigns value to a variable and does math in a shell
$(( )) Evaluates the enclosed expression
I am not able to get where should I use (( )) and $(( )). Could someone please provide me an example to understand it better. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
(( )) is for mathematical logical conditions
(( 7+8 == 15 )) && echo true
[[ ]] is for non mathematical logic
name=beer9
[[ $name == "beer9" ]] && echo equal
(( 7+8 == 15 )) && echo true
[[ ]] is for non mathematical logic
name=beer9
[[ $name == "beer9" ]] && echo equal
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
(( )) is for logical expression (true or false conditions)