Till now we have been sending the output of print and printf commands to stdout, that is, the screen. However, we can also redirect the output to files by using the redirection operator. Redirection is done after the print command. It is the same as we do in shell commands using redirection operator.
There are three forms of output redirection:
- Output to file
- Output appended to a file
- Output through a pipe to another command