Redian新闻
>
How to redirect error messages to a file?
avatar
How to redirect error messages to a file?# Unix - 噫吁兮,危乎高哉
T*B
1
sort largeFile > & logfile &
The above command will be core dumped when sorting a large file (30G). I want
to see the error message at the time it is dumped. The problem is that I have
to run the command in background.
The command I tried above doesn't work. It didn't catch the error message
during dumping. Any suggestions? Thanks a lot.
avatar
p*f
2

if you shell is like sh,
sort ... >logfile 2>errfile &

【在 T***B 的大作中提到】
: sort largeFile > & logfile &
: The above command will be core dumped when sorting a large file (30G). I want
: to see the error message at the time it is dumped. The problem is that I have
: to run the command in background.
: The command I tried above doesn't work. It didn't catch the error message
: during dumping. Any suggestions? Thanks a lot.

avatar
T*B
3
Thanks.
I am using tcsh. I will move to sh to try your advice.

want
have

【在 p******f 的大作中提到】
:
: if you shell is like sh,
: sort ... >logfile 2>errfile &

avatar
T*B
4
BTW, the 2> looks stange to me. Could you say something about it? thanks. hehe

message

【在 T***B 的大作中提到】
: Thanks.
: I am using tcsh. I will move to sh to try your advice.
:
: want
: have

avatar
s*g
5
redirect stderr. file no. of stderr = 2.

【在 T***B 的大作中提到】
: BTW, the 2> looks stange to me. Could you say something about it? thanks. hehe
:
: message

avatar
f*r
6
Both two commands are equal. Thus it should not solve your problem.

【在 T***B 的大作中提到】
: Thanks.
: I am using tcsh. I will move to sh to try your advice.
:
: want
: have

avatar
a*t
7

want
have
sort largefile > logfile 2>&1 &

【在 T***B 的大作中提到】
: sort largeFile > & logfile &
: The above command will be core dumped when sorting a large file (30G). I want
: to see the error message at the time it is dumped. The problem is that I have
: to run the command in background.
: The command I tried above doesn't work. It didn't catch the error message
: during dumping. Any suggestions? Thanks a lot.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。