使用Bash重定向到多个文件时的歧义重定向 [英] Ambiguous redirect when redirecting to multiple files using Bash
本文介绍了使用Bash重定向到多个文件时的歧义重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ echo "" > /home/jem/rep_0[1-3]/logs/SystemOut.log
bash: /home/jem/rep_0[1-3]/logs/SystemOut.log: ambiguous redirect
我可以一次重定向到多个文件吗?
Can I redirect to multiple files at a time?
允许使用歧义文件引用的任何答案吗?
Any answer that allows use of the ambiguous file reference?
推荐答案
这是tee的用途:
command | tee file1 file2 file3 > file4
tee也会输出到stdout,因此您可能要在重定向后放置一个文件(如上所示),或将stdout发送到/dev/null
.
tee also outputs to stdout, so you may want either to put one file after a redirect (as shown above), or send stdout to /dev/null
.
针对您的情况:
echo "" | tee /home/jem/rep_0[1-3]/logs/SystemOut.log >/dev/null
这篇关于使用Bash重定向到多个文件时的歧义重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文