Created
July 14, 2018 09:10
-
-
Save muxueqz/069e231046db2cdf23c78e27032d8bb4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
ESSID=$1 | |
wlan_client_interface=`iw dev | grep 'type managed' -B2 | grep Interface | cut -d' ' -f2` | |
wireless_channel='' | |
while [ "$wireless_channel" == '' ];do | |
wireless_channel=`iwlist ${wlan_client_interface} scan | grep -i $ESSID -B4 | grep Channel | head -n1 | cut -d: -f2` | |
done | |
sed -i "s/option channel '.*'/option channel '$wireless_channel'/g" /etc/config/wireless | |
/etc/init.d/network restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment