假设我有一个简单的程序: (伪代码)
for(i=0;i<1000;i++)
{
print(i + "\n");
sleep(1);
}
Output:
0
1
2
有没有办法在 emacs 或 Vi 等编辑器中查看此输出的变化? 我想要的行为就像对不断写入的文件执行“tail -f”。
最佳答案
这实际上是内置于 emacs :)
M-x auto-revert-tail-mode
从 C-h f auto-revert-tail-mode :
When Tail mode is enabled, the tail of the file is constantly followed, as with the shell command `tail -f'. This means that whenever the file grows on disk (presumably because some background process is appending to it from time to time), this is reflected in the current buffer.
关于linux - 如何在 linux 中的 emacs 或 Vim 等编辑器中查看程序的控制台输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7360881/