如何输出重定向到一个文件和stdout [英] How to redirect output to a file and stdout

查看:694
本文介绍了如何输出重定向到一个文件和stdout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在bash中,调用将显示来自该命令在标准输出任何输出。

In bash, calling foo would display any output from that command on the stdout.

调用富>输出将重定向从命令指定的文件中的任何输出(在这种情况下,输出)。

Calling foo > output would redirect any output from that command to the file specified (in this case 'output').

有没有办法将输出重定向到一个文件中的的有它显示在标准输出?

Is there a way to redirect output to a file and have it display on stdout?

推荐答案

你想要的命令被命名为 <一个href=\"http://www.gnu.org/software/coreutils/manual/html_node/tee-invocation.html\"><$c$c>tee:

The command you want is named tee:

ls -lR / | tee output.file

这篇关于如何输出重定向到一个文件和stdout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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