最后一个shell命令的输出 [英] Output of last shell command

查看:83
本文介绍了最后一个shell命令的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到3个小时的构建脚本进行到一半时,我都会记得我想在输出完成后看到一些内容。此时,我已经超出了终端的行数,因此无法向上滚动查看(否则很难找到开始的地方)。当然,我可以更好地存储输出,但是我一直很好奇这是否可能。

Not until midway through a 3 hour build script, I'll remember that I want to see something at the beginning of the output after it's done. At this point I've exceeded the number of lines in my terminal so I can't scroll up to see it (or the beginning is hard to find). Of course I can be better about storing my output, but I've always been curious if this were possible.

在linux shell中,是否可以返回输出最后一个命令。我知道我可以通过管道将其发送或将输出发送到文件,但是我的要求是在命令运行后检索该输出。

In a linux shell, is it possible to return the output of the last command. I realize I could have piped it or sent the output to a file, but my requirement is to retrieve that output after the command has been run.

使用csh,但会听到有关任何shell的信息。

Using csh, but would hear about any shell.

推荐答案

否。程序的输出永远不会通过外壳的双手。如果没有重定向,它将直接进入TTY。使用重定向,它可以直接到达它所指向的任何文件或管道。 shell不知道该进程将什么发送到stdout / stderr。

No. The output of a program never passes through the shell's hands. Without redirection, it goes straight to the TTY. With redirection, it goes straight to whatever file or pipe it was directed to. The shell has no idea what the process sent to stdout/stderr.

这篇关于最后一个shell命令的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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