read -p "请输入虚拟机名称:" name if virsh domstate $name | grep -q running; then echo"修改虚拟机网卡数据,需要关闭虚拟机,现在开始关机。" virsh destroy $name fi
mountpoint="/vms/images/temp_vm_mount" [ ! -d $mountpoint ] && mkdir$mountpoint echo"请稍后..." if mount | grep -q "$mountpoint"; then umount $mountpoint fi
# 检查新的配置文件是否已正确写入 if grep -q "$addr"$mountpoint/etc/netplan/00-installer-config.yaml && grep -q "$gateway"$mountpoint/etc/netplan/00-installer-config.yaml; then echo"完成..." fi