Before a command is executed, its input and output may be redirected. The following may appear anywhere in a simple command or may precede or follow a complex command.
Substitution occurs before word or digit is used except as noted below.
If the result of substitution on word produces more than one filename, redirection occurs for each separate filename in turn. If the file does not exist then it is created. If the file does not exist then it is created. If the file exists then output is appended to it. No parameter substitution, command substitution or filename generation is performed on word .