From 357f4a4c278c95ecddab7fce1e69b1571cdd0bea Mon Sep 17 00:00:00 2001 From: Georg Kunz Date: Sun, 2 Aug 2020 22:35:33 +0200 Subject: [PATCH] "Better" pattern matching for name of jump VM The pattern currently used matches also non-exact hits, such as "jumphost" and "xci-jumphost". This tweak attempts to achieve better exact word matches. Note: the -w option of grep does not seem to do the trick as well. Signed-off-by: Georg Kunz Change-Id: I8cb98a5540a41f5e6044efe12584403b7f4398df --- functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions.sh b/functions.sh index b0baf2d..55edfbf 100755 --- a/functions.sh +++ b/functions.sh @@ -10,10 +10,10 @@ # Clean up clean_up() { - if sudo virsh list --all | grep "${VM_NAME}.*running" ; then + if sudo virsh list --all | grep " ${VM_NAME} .*running" ; then sudo virsh destroy "$VM_NAME" fi - if sudo virsh list --all | grep "${VM_NAME}" ; then + if sudo virsh list --all | grep " ${VM_NAME} " ; then sudo virsh undefine "$VM_NAME" fi sudo rm -rf "/var/lib/libvirt/images/$VM_NAME" -- 2.16.6