Redian新闻
>
how to redirect error output under unix
avatar
how to redirect error output under unix# Unix - 噫吁兮,危乎高哉
s*n
1
I want to redirect the error output to a file, how to do
this? command > error.txt 2>&1 doesn't work(learn from a
shell programming book). sgi irix 6.5. thanks.
avatar
p*s
2

That is for Bourne/Korn/BourneAgain shells.
Guess you are using C shell, try to use >& instead of >

【在 s******n 的大作中提到】
: I want to redirect the error output to a file, how to do
: this? command > error.txt 2>&1 doesn't work(learn from a
: shell programming book). sgi irix 6.5. thanks.

avatar
s*n
3
yes, i am using tcsh. you mean this:
command >& error 2>&1
result: Ambiguous output redirect
i am a newbie of unix, thanks.

【在 p****s 的大作中提到】
:
: That is for Bourne/Korn/BourneAgain shells.
: Guess you are using C shell, try to use >& instead of >

avatar
p*s
4

command >& error
As I know, there is no way to separate stderr and stdout in c shells.
So actually the file "error" will hold both stdout and stderr.

【在 s******n 的大作中提到】
: yes, i am using tcsh. you mean this:
: command >& error 2>&1
: result: Ambiguous output redirect
: i am a newbie of unix, thanks.

avatar
s*n
5
that makes sense, what i want is ouputing the f77 compiler
license information to a file. everytime i compile a file,
it always output lots of dummy. thanks.

【在 p****s 的大作中提到】
:
: command >& error
: As I know, there is no way to separate stderr and stdout in c shells.
: So actually the file "error" will hold both stdout and stderr.

avatar
s*n
6
csh & tcsh,
(command > result.out) >& error.out

【在 s******n 的大作中提到】
: I want to redirect the error output to a file, how to do
: this? command > error.txt 2>&1 doesn't work(learn from a
: shell programming book). sgi irix 6.5. thanks.

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