The assembled line is now subjected to alias expansion. This is done by scanning the line, looking for pound (#), semicolon (;), and left brace ({) characters that are not inside strings.
Strings are recognized by their opening and closing double or single quotes. Backslash quotation causes a quote character not to terminate the string.
Pound (#) characters and all that follow to the end of the line are discarded, unless the pound character is the very first character in the line. If that is the case, the pound character is not discarded because a completely empty line has special meaning. An exception is made for pound (#) characters that are surrounded by non-whitespace characters, such as "file#name". This is needed because the tmpnam standard library function generates file and directory names containing pound (#) characters.
The debugger performs alias expansion as follows:
At the beginning of the line, and immediately after semicolon (;) or left brace ({) characters not inside strings, the debugger checks for the occurrence of an alias identifier.
If it finds an alias identifier, it associates the formal parameters of the alias with the specified actual parameters.
If the alias has no formal parameters, this match consumes no more of the input.
If there are formal parameters, white space is skipped, and then a '(' character is checked for and skipped. The characters following the '(' up to the first non-nested ',' or ')' character are associated with the formal parameter.
Again, the characters within strings are not tested. Nesting is caused by '(' and ')' characters outside of strings.
After the alias and the correct number of actuals have been identified, all the characters from the start of the alias identifier to its end (no parameters) or the trailing ')' (one or more parameters) are replaced by the expansion.
Within the definition of the alias, all occurrences of the formal parameter are replaced by the actual parameter, regardless of whether or not it is in a string.