The difference between parenthesis and brackets
The differences between [ ] [[ ]] and ( ) have been confusing to me.
() is for function headers
Corrected parentheses - thanks chrism01
(( )) as I understand it is posix and is looking for numbers # abc=6 ; if (( $abc -eq 6 )) ; then ; blah
[ ] is looking for a single logical condition # def="6" ; if [ "$def" == "6" ] ; then ; blah
[[ ]] is newer, and works in bash and will take nested logical analysis. # abc=6 ; if [[ $( $abc -eq 6 ) ]] ; then ; blah
I'm still not sure, but what I have been trying seems to have been working.
It would really be cool if someone made up a good one pager with examples.
Last edited by sarexpert; 10-09-2015 at 08:02 AM.
Reason: Fixed error
|