How do I redirect standard error in bash?

How do I redirect standard error in bash?
Answer
2> is input redirection symbol and syntax is:
  1. To redirect stderr (standard error) to a file: command 2> errors.txt.
  2. Let us redirect both stderr and stdout (standard output): command &> output.txt.
  3. Finally, we can redirect stdout to a file named myoutput.txt, and then redirect stderr to stdout using 2>&1 (errors.txt):
18 дек. 2020 г.
 

Tìm kiếm

Back
Top