拙劣的英文望指正 github:https://github.com/liuxu0315/vboxshowrunip
#!/bin/bash
#This shell script can find the ip of running virtualbox system
#But now(2016/04/18 23:20[beijing]),it only use to find one running virtualbox system
#此脚本用户找到 birdge 方式单台在运行的 virtualbox 虚拟机 ip
VMNAME=`vboxmanage list runningvms | awk -F '"' '{print $2}'`
if [ ! -n "VMNAME" ];then
for i in {100..120}
do
ping -c 1 192.168.1.$i &> /dev/null
done
VMMAC=`vboxmanage showvminfo ${VMNAME} |grep 'MAC'|awk '{print $4}'|awk -F',' '{print $1}' | sed -r 's/^(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})/\1:\2:\3:\4:\5:\6/'`
VMIP=`arp -a | grep -i $VMMAC |sed 's/^.*(\(.*\)).*$/\1/'`
echo $VMIP
else
echo "Enn... , not has running virtualbox system."
fi
1
wvuu 2016-04-19 10:11:58 +08:00
vboxmanage guestproperty enumerate $(vboxmanage list runningvms|awk -F\" '{print $2}')|awk -F': |, ' '/IP/{print $4}'
|
2
churchmice 2016-04-19 13:16:49 +08:00
你们这些个刷 github 的也够了,是不是 hello world 也要上去来一发?
|