1 ## compare_shells: dash bash mksh zsh
2
3 #### If
4 if true; then
5 echo if
6 fi
7 ## stdout: if
8
9 #### else
10 if false; then
11 echo if
12 else
13 echo else
14 fi
15 ## stdout: else
16
17 #### elif
18 if (( 0 )); then
19 echo if
20 elif true; then
21 echo elif
22 else
23 echo else
24 fi
25 ## stdout: elif
26
27 #### Long style
28 if [[ 0 -eq 1 ]]
29 then
30 echo if
31 echo if
32 elif true
33 then
34 echo elif
35 else
36 echo else
37 echo else
38 fi
39 ## stdout: elif
40
41
42 #### if break corner case
43
44 # This is analogous to the 'while' case in spec/loop
45 f() {
46 if break; then
47 echo hi
48 fi
49 }
50 f
51 ## STDOUT:
52 hi
53 ## END
54 ## BUG zsh stdout-json: ""
55 ## BUG zsh status: 1