1 #!/usr/bin/env bash
2 #
3 # Test the if statement
4
5 #### If
6 if true; then
7 echo if
8 fi
9 ## stdout: if
10
11 #### else
12 if false; then
13 echo if
14 else
15 echo else
16 fi
17 ## stdout: else
18
19 #### elif
20 if (( 0 )); then
21 echo if
22 elif true; then
23 echo elif
24 else
25 echo else
26 fi
27 ## stdout: elif
28
29 #### Long style
30 if [[ 0 -eq 1 ]]
31 then
32 echo if
33 echo if
34 elif true
35 then
36 echo elif
37 else
38 echo else
39 echo else
40 fi
41 ## stdout: elif
42