Created
April 30, 2020 19:11
-
-
Save velizarn/e63d112509efebd5068aa4444975be98 to your computer and use it in GitHub Desktop.
Automatically try to connect to a hidden network when WiFi is enabled
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 | |
# | |
# Automatically try to connect to "MyNetworkId" when WiFi is enabled | |
# | |
# https://askubuntu.com/questions/9014/auto-connect-to-hidden-wireless-without-elevating-privilege | |
# ...also adjust permissions | |
# the output of nmcli should be in English | |
LC_ALL=C | |
# loop for a while until NetworkManager is accepting commands | |
while [ "$(nmcli -t -f WIFI,STATE g)" = 'enabled:disconnected' ] | |
do | |
nmcli c up id MyNetworkId | |
sleep 5 | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment