|
|
coherent
if Command if Conditional command execution iiff _s_e_q_u_e_n_c_e_1 tthheenn _s_e_q_u_e_n_c_e_2 [eelliiff _s_e_q_u_e_n_c_e_3 tthheenn _s_e_q_u_e_n_c_e_4] ... [eellssee _s_e_q_u_e_n_c_e_5] fi The shell construct if executes commands conditionally, depending on the exit status of the execution of other commands. First, if executes the commands in sequence1. If the exit status is zero, it executes the commands in sequence2 and terminates. Otherwise, it executes the optional sequence3 if given, and ex- ecutes sequence4 if the exit status is zero. It executes addi- tional elif clauses similarly. If the exit status of each tested command sequence is nonzero, it executes the optional else part sequence5. Because the shell recognizes a reserved word only as the unquoted first word of a command, each then, elif, else, and fi must either occur unquoted at the start of a line or be preceded by `;'. The shell executes if directly. ***** Example ***** For an example of this command, see the entry for trap. ***** See Also ***** commands, sh, test COHERENT Lexicon Page 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.