arith1.sub 634 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # test of redone post-increment and post-decrement code
  2. ( echo $(( 4-- )) )
  3. ( echo $(( 4++ )) )
  4. ( echo $(( 4 -- )) )
  5. ( echo $(( 4 ++ )) )
  6. #ash# (( array[0]++ ))
  7. #ash# echo ${array}
  8. #ash# (( array[0] ++ ))
  9. #ash# echo ${array}
  10. #ash# (( a++ ))
  11. #ash# echo $a
  12. #ash# (( a ++ ))
  13. #ash# echo $a
  14. a=2
  15. echo 6 $(( a ++ + 4 ))
  16. echo 3 $a
  17. echo 7 $(( a+++4 ))
  18. echo 4 $a
  19. echo 0 $(( a---4 ))
  20. echo 3 $a
  21. echo 7 $(( a -- + 4 ))
  22. echo 2 $a
  23. echo -2 $(( a -- - 4 ))
  24. echo 1 $a
  25. #ash# (( ++ + 7 ))
  26. #ash# (( ++ ))
  27. ( echo $(( +++7 )) )
  28. # ++ is not a inc operator on non-variable, it is the + + sequence
  29. echo $(( ++ + 7 ))
  30. #ash# (( -- ))