检查stdout或stderr [英] Check for stdout or stderr

查看:73
本文介绍了检查stdout或stderr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Shell脚本中使用的二进制文件之一导致分段错误(返回值:139)

One of the binaries which I am using in my shell script is causing a segmentation fault (RETURN VALUE: 139)

尽管我将stdout和stderr都重定向到了一个日志文件,但是当我运行shell脚本时,在终端中会显示Segmentation Fault错误消息.

And even though, I am redirecting both stdout and stderr to a logfile, the Segmentation Fault error messages is displayed in the terminal when I am running the shell script.

是否可以将此消息从Segfault重定向到日志文件?

Is it possible to redirect this message from Segfault to a logfile ??

推荐答案

好,我正在回答自己的问题.. :)我在这里找到答案

Well, I am answering my own question.. :) I found the answer here How can I suppress the output due to a SIGSEGV or a SIGFPE in a Fortran 90 program?

诀窍是添加

`exec 2> filename`  

在外壳程序脚本中.

这会将所有消息从外壳重定向到日志文件

This will redirect all the messages from the shell to a log file

这篇关于检查stdout或stderr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆