COHERENT manpages
This page displays the COHERENT manpage for if [Execute a command conditionally].
List of available manpages
Index
if -- Command Execute a command conditionally if sequence1 then sequence2 [elif sequence3 then sequence4] ... [else sequence5] 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 executes sequence4 if the exit status is zero. It executes additional 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, ksh, sh, test