keyword

Bash esac reserved word

Closes a case construct. The selected clause runs according to the clause terminator. Quote literal pattern data where needed; esac must occur in grammar context rather than as an argument. 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
case word in pattern) list ;; esac

Return Value

compound command status

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

Working Example

Example Snippetbash
case report in report) printf 'selected\n' ;; *) exit 1 ;; esac
Bash Reference