Reserved words

The following reserved words for the Bourne shell are recognized only when they appear without quotation marks as the first word of a command.

for            do              done
case           esac
if             then             fi
elif           else
while          until
{              }
(              )

Item Description
forIdentifier [inWord. . .] doList done Sets the Identifier parameter to the word or words specified by the Word parameter (one at a time) and runs the commands specified in the List parameter. If you omit in Word. . ., then the for command runs the List parameter for each positional parameter that is set, and processing ends when all positional parameters have been used.
case Word in Pattern [|Pattern] . . . ) List;; [Pattern [|Pattern] . . . ) List;;] . . . esac Runs the commands specified in the List parameter that are associated with the first Pattern parameter that matches the value of the Word parameter. Uses the same character-matching notation in patterns that are used for file name substitution, except that a slash (/), leading dot (.), or a dot immediately following a slash (/.) do not need to match explicitly.
if List then List [elif List then List] . . . [else List] fi Runs the commands specified in the List parameter following the if command. If the command returns a zero exit value, the shell runs the List parameter following the first then command. Otherwise, it runs the List parameter following the elif command (if it exists). If this exit value is zero, the shell runs the List parameter following the next then command. If the command returns a nonzero exit value, the shell runs the List parameter following the else command (if it exists). If no else List or then List is performed, the if command returns a zero exit value.
while List do List done Runs the commands specified in the List parameter following the while command. If the exit value of the last command in the while List is zero, the shell runs the List parameter following the do command. It continues looping through the lists until the exit value of the last command in the while List is nonzero. If no commands in the do List are performed, the while command returns a zero exit value.
until List do List done Runs the commands specified in the List parameter following the until command. If the exit value of the last command in the until List is nonzero, runs the List following the do command. Continues looping through the lists until the exit value of the last command in the until List is zero. If no commands in the do List are performed, the until command returns a zero exit value.
( List ) Runs the commands in the List parameter in a subshell.
{ List; } Runs the commands in the List parameter in the current shell process and does not start a subshell.
Name () { List } Defines a function that is referenced by the Name parameter. The body of the function is the list of commands between the braces specified by the List parameter.