#!/bin/bash
rawIp=$(ip addr | grep eth0)
rawIp=$(echo $rawIp | egrep -o '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/')
echo ${rawIp::-1}
#!/bin/bash
hosts=/c/Windows/System32/drivers/etc/hosts
newHosts=/tmp/hosts
cp $hosts $newHosts
originIp=$(cat $newHosts | grep wsl)
newIp="$(getWslIp) wsl"
sed -i "s/$originIp/$newIp/" $newHosts
cp $newHosts $hosts