Filename Expansion
Each word is checked to see if it begins with an unquoted ~. If it
does, then the word up to a / is checked to see if it matches the name
of a named directory. If so, then the ~ and the matched portion are
replaced with the value of the named directory. A ~ by itself or
followed by a / is replaced by the value of the HOME
parameter. A ~ followed by a + or a - is replaced by the value of
PWD or OLDPWD, respectively.
Named directories are typically login directories for users on the system. They may also be defined if the text after the ~ is the name of a string shell parameter whose value begins with a /. In certain circumstances (in prompts, for instance), when the shell prints a path, the path is checked to see if it has a named directory as its prefix. If so, then the prefix portion is replaced with a ~ followed by the name of the directory. The longest match is preferred.
If a word begins with an unquoted = and the NO_EQUALS option is not set, the remainder of the word is taken as the name of a command or alias. If a command exists by that name, the word is replaced by the full pathname of the command. If an alias exists by that name, the word is replaced with the text of the alias. Otherwise the word is checked up to a / to see if it is a number or a -. If so, the matched portion is replaced with the nth directory in the directory stack, where n is the number matched, or the last directory in the directory stack if a - is matched.
Filename expansion is performed on the right hand side of a parameter assignment, including those appearing after commands of the typeset family. In this case, the right hand side will be treated as a colon-separated list in the manner of PATH so that a ~ or an = following a : is eligible for expansion. All such behavior can be disabled by quoting the ~, the =, or the whole expression (but not simply the colon); the NO_EQUALS option is also respected.
If the option MAGIC_EQUAL_SUBST is set, any unquoted shell argument in the form identifier=expression becomes eligible for file expansion as described in the previous paragraph. Quoting the first = also inhibits this.
Process Substitution
Each command argument of the form <(list) or
>(list) or =(list) is subject to process
substitution. In the case of the < or > forms, the
shell will run process list asynchronously connected to a named
pipe (FIFO). The name of this pipe will become the argument to the
command. If the form with > is selected then writing on this
file will provide input for list. If < is used, then
the file passed as an argument will be a named pipe connected to the
output of the list process. For example,
paste <(cut -f1 file1) <(cut -f3 file2) | tee >(process1) >(process2) >/dev/null
cuts fields 1 and 3 from the files file1 and file2 respectively, pastes the results together, and sends it to the processes process1 and process2. Note that the file, which is passed as an argument to the command, is a system pipe so programs that expect to lseek(2) on the file will not work. Also note that the previous example can be more compactly and efficiently written as:
paste <(cut -f1 file1) <(cut -f3 file2) > >(process1) > >(process2)
The shell uses pipes instead of FIFOs to implement the latter two process substitutions in the above example.
If = is used, then the file passed as an argument will be the name of a temporary file containing the output of the list process. This may be used instead of the < form for a program that expects to lseek(2) on the input file.