提问人:hruday 提问时间:10/5/2020 更新时间:10/5/2020 访问量:146
重定向 bash 命令的输出控制台消息
redirect output console message of bash command
问:
我执行以下命令
bash -c 'comm -12 <(sort vms1.txt) <(sort vms2.txt)'
它给出以下输出
sort: cannot read: vms1.txt: No such file or directory
sort: cannot read: vms2.txt: No such file or directory
如何抑制上述消息?我尝试了stderr重定向方法,但没有用
bash -c 'comm -12 <(sort vms1.txt) <(sort vms2.txt) 2>&-'
关键是禁止显示错误消息,并且不想在 stdout 上显示。
答: 暂无答案
上一个:抑制(难以捕获)R 函数的输出
下一个:在特定进程中抑制 stdout
评论
bash -c 'comm -12 <(sort vms1.txt 2>/dev/null) <(sort vms2.txt 2>/dev/null)'