w*****j 发帖数: 49 | 1 i want to redirect the error message to standard output, how can i do that? |
c*****t 发帖数: 1879 | 2 Normally, both the stderr and stdout output goes to the screen.
If you are redirecting the output to a file or command, you can
redirect stderr by
command > output.txt 2>&1
【在 w*****j 的大作中提到】 : i want to redirect the error message to standard output, how can i do that?
|
w*****j 发帖数: 49 | 3 I've tried the following:
ls nothing>error 2>&1
but it seems it doesn't work and told me:
ambiguous output redirect
【在 c*****t 的大作中提到】 : Normally, both the stderr and stdout output goes to the screen. : If you are redirecting the output to a file or command, you can : redirect stderr by : command > output.txt 2>&1
|
c*****t 发帖数: 1879 | 4 Which shell are you using?
If you are using tcsh, then it is
command >& output.txt
(both the stdout and stderr are logged into output.txt)
【在 w*****j 的大作中提到】 : I've tried the following: : ls nothing>error 2>&1 : but it seems it doesn't work and told me: : ambiguous output redirect
|
w*****j 发帖数: 49 | 5 You are right, thanks man
【在 c*****t 的大作中提到】 : Which shell are you using? : If you are using tcsh, then it is : command >& output.txt : (both the stdout and stderr are logged into output.txt)
|
p*****s 发帖数: 47 | 6 that depends on shells or systems
try 2>1 , >& 1
【在 w*****j 的大作中提到】 : i want to redirect the error message to standard output, how can i do that?
|
xt 发帖数: 17532 | 7 somecommand 2>/dev/stdout
【在 w*****j 的大作中提到】 : i want to redirect the error message to standard output, how can i do that?
|