我有以下命令:
cnee -replay -f $filename.xns -sk q -ns
我想在运行时禁止xnee的所有输出。我尝试将其更改为
DUMMY=$( cnee -replay -f $filename.xns -sk q -ns )
基于我在这里找到的建议:How to suppress all output from a command using Bash?
问题是,我仍然看到此输出:
Workaround: Creating context on data display instead of control
You can ignore this message
Workaround: Creating context on data display instead of control
You can ignore this message
NOTIFICATION: If you have problem with Xnee and recording device events: File a bug report including this text.
NOTIFICATION: If you have problem with Xnee and recording device events: File a bug report including this text.
Workaround: Creating context on data display instead of control
You can ignore this message
有什么想法,尽管在$()中对变量执行了命令,仍然可以将命令输出到shell?
bash版本:GNU bash,版本4.3.48(1)-发行版(x86_64-pc-linux-gnu)
答案 0 :(得分:0)
一种常见的处理方法是
$ your_command &> /dev/null
会将stdin和stderr都发送到黑洞。您也可以有选择地过滤stdin或stderr。