Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
BASH-如何将它们发送到仅对话的标准输出和文件/root/sh/sh.log标准输出+;输出误差_Bash_Shell - Fatal编程技术网

BASH-如何将它们发送到仅对话的标准输出和文件/root/sh/sh.log标准输出+;输出误差

BASH-如何将它们发送到仅对话的标准输出和文件/root/sh/sh.log标准输出+;输出误差,bash,shell,Bash,Shell,你好 如何将它们发送到仅对话标准输出和文件/root/sh/sh.log标准输出+输出错误 # I need dialog == standard output /root/sh/sh.log == standard output + error output # My experimental start 2>&1 /root/sh/menu.log | dialog --stdout --progressbox 20 200; 谢谢我想试试这样的 启动2

你好

如何将它们发送到仅对话标准输出和文件/root/sh/sh.log标准输出+输出错误

# I need
dialog          == standard output
/root/sh/sh.log == standard output + error output 

# My experimental
start 2>&1 /root/sh/menu.log | dialog --stdout --progressbox 20 200;
谢谢

我想试试这样的
启动2>/root/sh/sh.log | tee-a/root/sh/sh.log |对话框

您可以尝试使用
tee
命令并处理替换

{ start | tee >( dialog --stdout --progressbox 20 200) ; } > /root/sh/menu.log 2>&1
在命令组中,标准输出被传递到
tee
,tee将写入一个“文件”,该文件实际上是一个进程替换构造,它将输入传递到
对话框
命令。将其视为标准输出的分叉管道


由于标准错误不会重定向,并且
tee
将其输入传递回标准输出,因此这两个错误都会从命令组中传递出去。首先,我们将标准输出重定向到所需的日志文件,然后将标准错误复制到标准输出所在的位置。

我做了一些编辑,以修复与
bash
相关的部分;我没有专门测试这些命令的
start
dialog