keyword
Bash elif branch
Tests another condition only after all earlier conditions fail; must appear inside if.
Formal Syntax & Structure
bash syntaxbash
elif command; then commandsReturn Value
behavior
Tests another condition only after all earlier conditions fail; must appear inside if.
Working Example
Example Snippetbash
if false; then printf '%s\n' firstelif true; then printf '%s\n' secondelse printf '%s\n' fallbackfi