Extract VM IPv4 address using regular expression.

This commit is contained in:
Rohan Barar 2024-07-01 21:42:39 +10:00
parent 07d726f964
commit 5342eb75cb

View File

@ -71,8 +71,7 @@ if [ -z "$RDP_IP" ]; then
echo " virsh start RDPWindows" echo " virsh start RDPWindows"
exit exit
fi fi
RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}') RDP_IP=$(virsh net-dhcp-leases default | grep "RDPWindows" | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}')
RDP_IP=${RDP_IP%%\/*}
fi fi
dprint "1:$1" dprint "1:$1"