| 1 | #!/bin/bash |
| 2 | # |
| 3 | # let arithmetic. |
| 4 | |
| 5 | ### let |
| 6 | # NOTE: no spaces are allowed. How is this tokenized? |
| 7 | let x=1 |
| 8 | let y=x+2 |
| 9 | let z=y*3 # zsh treats this as a glob; bash doesn't |
| 10 | let z2='y*3' # both are OK with this |
| 11 | echo $x $y $z $z2 |
| 12 | # stdout: 1 3 9 9 |
| 13 | # OK zsh stdout-json: "" |
| 14 | |
| 15 | ### let with () |
| 16 | let x=( 1 ) |
| 17 | let y=( x + 2 ) |
| 18 | let z=( y * 3 ) |
| 19 | echo $x $y $z |
| 20 | # stdout: 1 3 9 |
| 21 | # N-I mksh/zsh stdout-json: "" |