Created
March 19, 2019 13:26
-
-
Save andrievsky/65077f8ce11f06fcb7fbe5ff94793aac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#ifconfig | |
#dhclient -r wlp7s0 | |
#dhclient wlp7s0 | |
ADAPTER_ID=$(ifconfig | grep -o "\w*wl\w*") | |
if [ -z "$ADAPTER_ID" ] | |
then | |
echo "No wl* adapters found" | |
else | |
echo "Adapter found: ${ADAPTER_ID}" | |
fi | |
RESULT=$(ifconfig | awk '/wl/,/netmask/' | grep 192.168) | |
while [ -z "$RESULT" ] | |
do | |
dhclient -r ${ADAPTER_ID} | |
dhclient ${ADAPTER_ID} | |
RESULT=$(ifconfig | awk '/wl/,/netmask/' | grep 192.168) | |
done | |
echo "Done : $RESULT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment