There are three common file descriptors in shell programming:
0: stdin, standard input. The default value is the keyboard input.
1: stdout, standard output. The default value is screen output.
2: stderr, standard error output. The default value is screen output.
Simple redirection example
Command example
MD> file redirects stdout to file. CMD> file redirects stdout to file (append) CMD 1> Fiel redirects stdout to the file. CMD> file 2> & 1 redirects stdout and stderr together to the file. CMD 2> file redirects stderr to the file. cmd 2> file redirects stderr to the file (append) CMD> file 2> & 1 redirects stderr and stderr together to the file (append) CMD <File> file2 cmd command uses the file as stdin, use file2 file as stdoutcat <> file to open filecmd in read/write mode <file cmd command to use file as stdincmd <delimiter here document read from stdin until delimiter Delimiter is encountered