When I run the command haizea -c simulated.conf > result.txt, the program (haizea) still prints its output to the screen. But when I try haizea -c simulated.conf 1>& result.txt, the output is now on the file result.txt. I’m quite confused about this situation. What is the difference between > and 1>&, then?
When I run the command haizea -c simulated.conf > result.txt , the program (
Share
What you’re seeing on the terminal is the standard error of your process. Both of these are directed to the same terminal device by default (assuming no redirection put into effect).
The redirection
>&xyzredirects both standard output and error to the filexyz.I’ve never used it but I would think, by extension, that
N>&xyzwould redirect file handleNand standard error to your file. So1>&xyzis equivalent to>&xyzwhich is also equivalent to>xyz 2>&1.