keyword

Bash fi reserved word

Closes an if construct, including optional elif and else branches. The if construct status is that of the last executed branch command, or zero if no condition was true and no else ran. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): fallback.

Formal Syntax & Structure

bash syntaxbash
if list; then list; fi

Return Value

compound command status

Reserved word has no separate exit status; the enclosing construct determines status.

Working Example

Example Snippetbash
if false; then printf 'wrong\n'; else printf 'fallback\n'; fi
Bash Reference