首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >virsh销毁&> /dev/null仍然显示空输出

virsh销毁&> /dev/null仍然显示空输出
EN

Stack Overflow用户
提问于 2021-12-08 23:59:22
回答 1查看 74关注 0票数 1

所以我有个烦人的问题。我有一个脚本可以更改给定文本文件上的一些配置。要更改该特定文件,我必须首先销毁KVM上的虚拟机来宾。问题是,每次它停止时,脚本的输出中都有一个空格,如您所见:

代码语言:javascript
复制
vfp-8vr Found!
Check if vfp-8vr has stopped ................................. [OK]

Check if vfp-8vr node has changed ............................ [OK]
Check if vfp-8vr has started ................................. [OK]
vfp-9vr Found!
Check if vfp-9vr has stopped ................................. [OK]

Check if vfp-9vr node has changed ............................ [OK]
Check if vfp-9vr has started ................................. [OK]
vfp-10vr Found!
Check if vfp-10vr has stopped ................................. [OK]

Check if vfp-10vr node has changed ............................ [OK]
Check if vfp-10vr has started ................................. [OK]

我在我的脚本中包含了/dev/null,因为它隐藏了输出,理论上它可以工作,但是仍然有一个银行空间显示,不管.

代码语言:javascript
复制
for i in "${arr[@]}"
do
  if [[ -n "$i" ]]
     then
         echo "$i Found!"

         virsh destroy $i &> /dev/null
         echo -e "Check if \e[32m$i\e[0m has stopped ................................. [OK]"

         virsh numatune $i $opt_node0
         echo -e "Check if \e[32m$i\e[0m node has changed ............................ [OK]"

         virsh start $i &> /dev/null
         echo -e "Check if \e[32m$i\e[0m has started ................................. [OK]"

  fi
done

有没有人知道我如何在后台运行virsh destroy,而不显示输出中那个烦人的空间呢?

免责声明:我也使用过[Command] > /dev/null 2>&1 &,也使用了相同的东西:/

EN

回答 1

Stack Overflow用户

发布于 2021-12-09 00:23:45

愚蠢的我,我忘记将/dev/null添加到命令中:

代码语言:javascript
复制
Check if vfp-8vr has stopped ................................. [OK]
Check if vfp-8vr node has changed ............................ [OK]
Check if vfp-8vr has started ................................. [OK]
vfp-9vr Found!
Check if vfp-9vr has stopped ................................. [OK]
Check if vfp-9vr node has changed ............................ [OK]
Check if vfp-9vr has started ................................. [OK]
vfp-10vr Found!
Check if vfp-10vr has stopped ................................. [OK]
Check if vfp-10vr node has changed ............................ [OK]
Check if vfp-10vr has started ................................. [OK]

谢谢社区!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70283181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档