I want to know what exactly is the difference between
a=$[1+1]
a=$((1+1))
let a=1+1
a=$(expr 1 + 1 )
All 4 assign the variable a with 2, but what is the difference?
From what I found out so far, is that expr is slower because it is not an actual shell builtin. But not anything more than that.
((...))actually can be used for assignments inbash,kshandzsh:n=10; ((n+=10)); echo $nprints 20 and((x=1)); echo $xprints 1. – Alexej Magura Dec 06 '19 at 17:45