Table of Contents

RESERVED WORDS

The following words are recognized as reserved words when used as the first word of a command unless quoted or removed using the unalias builtin:

do done esac then elif else fi for case if while function repeat time until exec command select coproc noglob - nocorrect foreach end

COMMENTS

In noninteractive shells, or in interactive shells with the INTERACTIVE_COMMENTS option set, a word beginning with the third character of the HISTCHARS parameter (`#' by default) causes that word and all the following characters up to a newline to be ignored.

ALIASING

Every token in the shell input is checked to see if there is an alias defined for it. If so, it is replaced by the text of the alias if it is in command position (if it could be the first word of a simple command), or if the alias is global. If the text ends with a space, the next word in the shell input is treated as though it were in command position for purposes of alias expansion. An alias is defined using the alias builtin; global aliases may be defined using the g option to that builtin.

Alias substitution is done on the shell input before any other substitution except history substitution. Therefore, if an alias is defined for the word foo, alias substitution may be avoided by quoting part of the word, e.g. \foo. But there is nothing to prevent an alias being defined for \foo as well.

QUOTING

A character may be quoted (that is, made to stand for itself) by preceding it with a \. \ followed by a newline is ignored. All characters enclosed between a pair of single quotes ('') are quoted, except the first character of HISTCHARS ( `!' by default). A single quote cannot appear within single quotes. Inside double quotes (""), parameter and command substitution occurs, and \ quotes the characters \, `, ", and $.

EXPANSION

Expansion is performed on the command line after it has been parsed. The types of expansions performed are filename expansion, process substitution, parameter expansion, command substitution, arithmetic expansion, brace expansion, and filename generation.


Mark D. Borges