3
0

arith2.sub 929 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # bash 3.2 apparently thinks that ++7 is 7 etc
  2. ( echo $(( --7 )) )
  3. ( echo $(( ++7 )) )
  4. ( echo $(( -- 7 )) )
  5. ( echo $(( ++ 7 )) )
  6. #ash# ((++array[0] ))
  7. #ash# echo 1 $array
  8. #ash# (( ++ array[0] ))
  9. #ash# echo 2 $array
  10. #ash# (( ++a ))
  11. #ash# echo 1 $a
  12. #ash# (( ++ a ))
  13. #ash# echo 2 $a
  14. #ash# (( --a ))
  15. #ash# echo 1 $a
  16. #ash# (( -- a ))
  17. #ash# echo 0 $a
  18. a=0
  19. echo 5 $(( 4 + ++a ))
  20. echo 1 $a
  21. # this is treated as 4 + ++a
  22. echo 6 $(( 4+++a ))
  23. echo 2 $a
  24. a=2
  25. # this is treated as 4 - --a
  26. echo 3 $(( 4---a ))
  27. echo 1 $a
  28. a=1
  29. echo 4 $(( 4 - -- a ))
  30. echo 0 $a
  31. #ash# (( -- ))
  32. # bash 3.2 apparently thinks that ---7 is -7
  33. #ash# echo $(( ---7 ))
  34. ( echo $(( -- - 7 )) )
  35. #ash# (( ++ ))
  36. # bash 3.2: 7
  37. #ash# echo 7 $(( ++7 ))
  38. ( echo $(( ++ + 7 )) )
  39. # bash 3.2: -7
  40. #ash# echo -7 $(( ++-7 ))
  41. # bash 3.2: -7
  42. #ash# echo -7 $(( ++ - 7 ))
  43. # bash 3.2: 7
  44. #ash# echo 7 $(( +--7 ))
  45. # bash 3.2: 7
  46. #ash# echo 7 $(( -- + 7 ))