Hi all,
Is it possible to wait till the wifi (TP-Link USB dongle with Atheros chip) is connected in a bash script, which starts a program that requires network access?


if [ $(ip route | grep wlan0 | wc -l) != 0 ]; then
# wlan0 found in "ip route" output
else
# wlan0 not found in "ip route" output
fi


ifconfig wlan0 | grep -i 'inet addr'



while : ; do
if [ $(ifconfig wlan0 | grep -i 'inet addr' | wc -l) != 0 ]; then
# wlan0 has IP address, exit loop
break
fi
# sleep 1 second
sleep 1
done


Users browsing this forum: No registered users and 3 guests