I have read this question and answer - Redirect stderr to stdout but nothing seems to work to capture the error of a software called OpenMPI on Ubuntu 16.04 LTS. I have the OpenMPI commands in a shell script by typingmpirun -np 4 command and then on a command prompt I type job_script >& logs This captures the application software errors and output but does not capture the OpenMPI errors that the script throws. How do I capture the OpenMPI errors as well as right now as these are going going to standard error ? 
Unable to redirect standard error of openmpi in csh to file
io redirection;csh
The >& operator redirects both standard error and standard output to the same destination. Redirecting standard error is one of the most famous things that csh cannot do, so if you wanted to do that, the answer would be that it's impossible. (Of course, it's possible but only by going through another program such as sh.) However, you want to redirect stdout as well as stderr, and >& does exactly this.If job_script >& logs emits some output, then the application must be writing directly to the terminal. You can't capture that with redirection. You can use the script command to log everything, including terminal output, to a file.script -c 'job_script' logs >/dev/nullThis being said, it's 2017. It's been about 15 years since (t)csh had any advantage over bash for interactive use, about 25 years over zsh, and csh has never been good at scripting. It's more than time to retire it.