|
|
1.1 root 1:
2:
3: if Command if
4:
5:
6:
7:
8: Conditional command execution
9:
10: iiff _s_e_q_u_e_n_c_e_1
11: tthheenn _s_e_q_u_e_n_c_e_2
12: [eelliiff _s_e_q_u_e_n_c_e_3
13: tthheenn _s_e_q_u_e_n_c_e_4] ...
14: [eellssee _s_e_q_u_e_n_c_e_5]
15: fi
16:
17: The shell construct if executes commands conditionally, depending
18: on the exit status of the execution of other commands.
19:
20: First, if executes the commands in sequence1. If the exit status
21: is zero, it executes the commands in sequence2 and terminates.
22: Otherwise, it executes the optional sequence3 if given, and ex-
23: ecutes sequence4 if the exit status is zero. It executes addi-
24: tional elif clauses similarly. If the exit status of each tested
25: command sequence is nonzero, it executes the optional else part
26: sequence5.
27:
28: Because the shell recognizes a reserved word only as the unquoted
29: first word of a command, each then, elif, else, and fi must
30: either occur unquoted at the start of a line or be preceded by
31: `;'.
32:
33: The shell executes if directly.
34:
35: ***** Example *****
36:
37: For an example of this command, see the entry for trap.
38:
39: ***** See Also *****
40:
41: commands, sh, test
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.