From 5342eb75cb12671eff01cb9334db09733cb2d69b Mon Sep 17 00:00:00 2001 From: Rohan Barar Date: Mon, 1 Jul 2024 21:42:39 +1000 Subject: [PATCH] Extract VM IPv4 address using regular expression. --- bin/winapps | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/winapps b/bin/winapps index f47a887..6eedc66 100755 --- a/bin/winapps +++ b/bin/winapps @@ -71,8 +71,7 @@ if [ -z "$RDP_IP" ]; then echo " virsh start RDPWindows" exit fi - RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}') - RDP_IP=${RDP_IP%%\/*} + RDP_IP=$(virsh net-dhcp-leases default | grep "RDPWindows" | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}') fi dprint "1:$1"