detect more network interface names

This commit is contained in:
arno
2020-07-22 16:56:10 +02:00
parent c2386ab3e2
commit 2bb44bfc95
2 changed files with 3 additions and 3 deletions

View File

@@ -239,7 +239,7 @@ fi
gotLocalIP=0
until [ ${gotLocalIP} -eq 1 ]
do
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | grep 'eth0\|wlan0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | egrep -i '(eth|ens|enp|eno|wlan|wlp)' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
if [ ${#localip} -eq 0 ]; then
# display user to connect LAN
sed -i "s/^state=.*/state=noIP/g" ${infoFile}

View File

@@ -17,7 +17,7 @@ sudo mkdir /mnt/hdd/temp 2>/dev/null
sudo chmod 777 -R /mnt/hdd/temp 2>/dev/null
# localIP
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | grep 'eth0\|wlan0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | egrep -i '(eth|ens|enp|eno|wlan|wlp)' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
echo "localIP='${localip}'"
# temp - no measurement in a VM
@@ -267,4 +267,4 @@ fi
# info on scan run time
endTime=$(date +%s)
runTime=$(echo "${endTime}-${startTime}" | bc)
echo "scriptRuntime=${runTime}"
echo "scriptRuntime=${runTime}"