在bash脚本中使用的virsh更改DHCP IP范围Virbr0的XML文件 [英] Changing the dhcp IP range in Virbr0's XML file using virsh in bash script
问题描述
我需要改变一个bash脚本中Virbr0的XML配置文件的DHCP范围。它可以使用命令的virsh网编辑默认的改变,但我不知道怎么可以把它从一个bash脚本完成的。
任何帮助或解释的要求将是非常美联社preciated的问题。
预先感谢您的关心。 :)
I need to change the dhcp range of Virbr0's XML configuration file within a bash script. It can be changed using the command "virsh net-edit default", but I don't know how can it be done from a bash script. Any help or explanation of the question asked would be highly appreciated. Thank you in advance for your concern. :)
推荐答案
网编辑调用编辑在编辑器中设置,所以你应该能够:被设置为一个非交互式编辑:
net-edit invokes the editor set in EDITOR, so you should be able to set that to a non-interactive editor:
EDITOR='sed -i s/foo/bar/g' virsh net-edit default
根据的virsh究竟如何调用它,你可能要包装你的编辑code。在修改了$ 1中给出,然后设置EDITOR该脚本文件名的脚本。
Depending on how exactly virsh invokes it, you may have to wrap your editing code in a script that modifies the filename given in "$1", then set EDITOR to that script.
这篇关于在bash脚本中使用的virsh更改DHCP IP范围Virbr0的XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!