I have been working with some bash scripting lately and been looking through the man pages. From what I have gathered, does $(( )) mean expr and [ ] mean test?
For $(( )):
echo $(( 5 + 3 ))
has the same output as:
echo $(expr 5 + 3)
For [ ]:
test 'str' = 'str'
has the same success value as:
[ 'str' = 'str' ]
Did I get my understanding right?
the
((...))construct is equivalent to the bash builtinlet.letdoes mostly the same stuff whichexprdoes.the
$((...))construct, note the$at the beginning, will substitute the output of the expression inside just like$(...)does.the
[...]construct is in fact just another name fortest.see the bash help pages for more information.
help "("help lethelp [help testsee also: