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 builtin let
. let
does mostly the same stuff which expr
does.
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 for test
.
see the bash help pages for more information.
help "("
help let
help [
help test
see also:
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