Defining a pipeline to be one or more commands means a single command is also a pipeline, albeit one that doesn't actually involve a pipe. The benefit is that
! as a negation operator doesn't have to be defined separately for commands and pipelines; it need only be defined as applying to a pipeline.
! cmd1 | cmd2, the
! negates the exit status of the entire pipeline, not just the single command
cmd1. The exit status of a pipeline, by default, is the exit status of the right-most command.
Likewise, a list is one more pipelines joined by
||. Thus, a single pipeline is also a list, and a single command is also a list. Then, when a command like
if is defined as taking a list between the
then keywords, this automatically includes single commands and single pipelines as part of the definition of a command.
A list consisting of two pipelines (one of which only consists of one command):
if IFS= read -r response && echo "$response" | grep foo; then
A list consisting of a single pipeline:
if echo "$foo" | grep foo; then
A list consisting of single pipeline (which itself contains only a single command):
if true; then