0

I've read several posts on stackoverflow on this topic, but nothing seems to suit me. when I run 'make' I get bunch of stderr outputs. so I tried

$ make &> make.log
Invalid null command.
$ make 2> make.log
make: *** No rule to make target '2'. Stop.
$ make >> file.txt 2>&1
Ambiguous output redirect.

Anybody good idea? I'm using /bin/csh. Thanks!

Chan Kim
  • 5,177
  • 12
  • 57
  • 112

2 Answers2

0

You can try the following which will redirect stdout and stderr to make.log:

make >& make.log

Or

(make > stdout.file) >& stderr.file

Or you can try sending the stdout to the terminal and capturing errors in make.log

(make >/dev/tty) >& make.log
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
0

This question was treated partially in https://stackoverflow.com/a/21345223/3008526.

One should note that in the csh manpage, stderr is not mentioned, but if you look for "diagnostic output" you'll get the correct references.

What you cannot do in csh by itself is redirect stderr and stdout separately.
It's not possible in csh to do you would write in bash as:

# bash instruction, no equivalent in csh
$ instruction 2>&1 1>file | pipe_treats_error_info_only

You can however merge both output channels:

# bash instruction, direct both stdout and stderr to file
$ instruction 1>file 2>&1
# csh instruction, direct both stdout and stderr to file
% instruction > & file

# bash instruction, direct both stdout and stderr to stdin of pipe_instruction
$ instruction 2>&1 | pipe_instruction
# csh instruction, direct both stdout and stderr to stdin of pipe_instruction
$ instruction | & pipe_instruction
Community
  • 1
  • 1
liselorev
  • 73
  • 4