1# ++ and -- are not inc/dec operators on non-variables, they are + + and - - sequences 2( echo $(( --7 )) ) 3( echo $(( ++7 )) ) 4( echo $(( -- 7 )) ) 5( echo $(( ++ 7 )) ) 6 7#ash# ((++array[0] )) 8#ash# echo 1 $array 9#ash# (( ++ array[0] )) 10#ash# echo 2 $array 11 12#ash# (( ++a )) 13#ash# echo 1 $a 14#ash# (( ++ a )) 15#ash# echo 2 $a 16 17#ash# (( --a )) 18#ash# echo 1 $a 19#ash# (( -- a )) 20#ash# echo 0 $a 21 a=0 22 23echo 5 $(( 4 + ++a )) 24echo 1 $a 25 26# this is treated as 4 + ++a 27echo 6 $(( 4+++a )) 28echo 2 $a 29 a=2 30 31# this is treated as 4 - --a 32echo 3 $(( 4---a )) 33echo 1 $a 34 a=1 35 36echo 4 $(( 4 - -- a )) 37echo 0 $a 38 39#ash# (( -- )) 40# -- is not a dec operator on non-variable, it is the - - sequence 41echo $(( ---7 )) 42( echo $(( -- - 7 )) ) 43 44#ash# (( ++ )) 45# ++ is not a inc operator on non-variable, it is the + + sequence 46echo $(( ++7 )) 47( echo $(( ++ + 7 )) ) 48 49echo -7 $(( ++-7 )) 50echo -7 $(( ++ - 7 )) 51 52echo 7 $(( +--7 )) 53echo 7 $(( -- + 7 )) 54