Denis Vlasenko | 1c660b4 | 2007-03-05 00:27:50 +0000 | [diff] [blame] | 1 | # bash 3.2 apparently thinks that ++7 is 7 etc |
| 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 | |
| 23 | echo 5 $(( 4 + ++a )) |
| 24 | echo 1 $a |
| 25 | |
Denys Vlasenko | f19e3c1 | 2018-01-28 20:13:33 +0100 | [diff] [blame] | 26 | # this is treated as 4 + ++a |
| 27 | echo 6 $(( 4+++a )) |
| 28 | echo 2 $a |
Denis Vlasenko | 1c660b4 | 2007-03-05 00:27:50 +0000 | [diff] [blame] | 29 | a=2 |
| 30 | |
Denys Vlasenko | f19e3c1 | 2018-01-28 20:13:33 +0100 | [diff] [blame] | 31 | # this is treated as 4 - --a |
| 32 | echo 3 $(( 4---a )) |
| 33 | echo 1 $a |
Denis Vlasenko | 1c660b4 | 2007-03-05 00:27:50 +0000 | [diff] [blame] | 34 | a=1 |
| 35 | |
| 36 | echo 4 $(( 4 - -- a )) |
| 37 | echo 0 $a |
| 38 | |
| 39 | #ash# (( -- )) |
| 40 | # bash 3.2 apparently thinks that ---7 is -7 |
| 41 | #ash# echo $(( ---7 )) |
| 42 | ( echo $(( -- - 7 )) ) |
| 43 | |
| 44 | #ash# (( ++ )) |
| 45 | # bash 3.2: 7 |
| 46 | #ash# echo 7 $(( ++7 )) |
| 47 | ( echo $(( ++ + 7 )) ) |
| 48 | |
| 49 | # bash 3.2: -7 |
| 50 | #ash# echo -7 $(( ++-7 )) |
| 51 | # bash 3.2: -7 |
| 52 | #ash# echo -7 $(( ++ - 7 )) |
| 53 | |
| 54 | # bash 3.2: 7 |
| 55 | #ash# echo 7 $(( +--7 )) |
| 56 | # bash 3.2: 7 |
| 57 | #ash# echo 7 $(( -- + 7 )) |