Square brackets are a common convention in documentation to indicate that what is inside the bracket is optional. They are part of the metasyntax used by the documentation.
The ...
notation is also metasyntax; it indicates that the preceding element may be repeated.
Other common metasyntax include parentheses for grouping and |
to mean “or”. Here, it happens that the parentheses and vertical bar are all part of the syntax, whereas the square brackets are all part of the metasyntax.
Good manuals typeset metasyntax in a different font from the syntax. Neither the webpage that you're reading nor the bash manual that it plagiarizes do so in their description of the case
command. The bash manual typesets the words word
, pattern
and command-list
in italic; this is also metasyntax, indicating that these words are a description of what goes at this position, rather than words to be typed literally like case
, in
and esac
.
case
word in
[ [(
] pattern [|
pattern]...)
command-list ;;
]... esac