Skip to content

Instantly share code, notes, and snippets.

@shrekuu
Last active March 25, 2021 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrekuu/7a1c166c335fc5a5a90f5f222cfd2bad to your computer and use it in GitHub Desktop.
Save shrekuu/7a1c166c335fc5a5a90f5f222cfd2bad to your computer and use it in GitHub Desktop.
ensure-wifi-connection.sh
#!/bin/bash
if ethtool wlp2s0 | grep -q "Link detected: no"; then
echo connecting
echo $(nmcli d connect wlp2s0)
else
echo connected
fi
#!/bin/bash
nmcli d connect wlp2s0
# wlp2s0 is the name of my wifi device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment