Skip to content

Instantly share code, notes, and snippets.

@andrievsky
Created March 19, 2019 13:26
Show Gist options
  • Save andrievsky/65077f8ce11f06fcb7fbe5ff94793aac to your computer and use it in GitHub Desktop.
Save andrievsky/65077f8ce11f06fcb7fbe5ff94793aac to your computer and use it in GitHub Desktop.
#!/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