keyword
Bash then reserved word
Introduces the command list executed if the condition succeeds. Separate it from the test using a newline or semicolon. This is a reserved word, not an external executable. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): selected.
Formal Syntax & Structure
bash syntaxbash
if list; then list; fiReturn Value
compound command status
Reserved word has no separate exit status; the enclosing construct determines status.
Working Example
Example Snippetbash
if true; then printf 'selected\n'; fi