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 |
# OK zsh status: 1 |
15 |
|
16 |
### let with () |
17 |
let x=( 1 ) |
18 |
let y=( x + 2 ) |
19 |
let z=( y * 3 ) |
20 |
echo $x $y $z |
21 |
# stdout: 1 3 9 |
22 |
# status: 0 |
23 |
# N-I mksh/zsh stdout-json: "" |
24 |
# N-I mksh/zsh status: 1 |