[Terminal use] Bash standard input and output

Glossary:

  • Standard input ( stdin ): input on the keyboard to pass information to the computer. File descriptor ---> 0
  • Standard correct output ( stdout ): the correct output on the screen to pass information to people. File descriptor ---> 1
  • Standard error output ( stderr ): the error output on the screen , to pass information to people. File descriptor ---> 2

Related symbols:

  • ">", "1>": The standard correctly overrides the redirection, which will overwrite the original content in the file.
  • "2>": Standard error overrides redirection, which will overwrite the original content in the file.
  • "&>": The standard correct and error overrides are redirected together, which will overwrite the original content in the file.
  • ">>", "1 >>": Standard correct append redirection will append information to the end of the file.
  • "2 >>": standard error append redirection, appending information to the end of the file.
  • "<": Standard input.

 

1. Write a simple script file and run it.

 

2. "1>" standard correct override redirection, "2>" standard error override redirection, "&>" standard correct, error override redirection together, will overwrite the original content in the file.

 

3. "1 >>" standard correct append redirection, "2 >>" standard error append redirection, will append the information to the end of the file (it will not overwrite the content in the original file ).

 

 

Guess you like

Origin www.cnblogs.com/greamrod/p/12737101.html