Created
July 14, 2017 19:27
-
-
Save smlb/e2b69a9a235531a87f0f783e1e8c29b1 to your computer and use it in GitHub Desktop.
ladroga
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/bash | |
active_connection=`awk '/\*/ {print $2}' <(netctl list)` | |
red='\e[0;31m' | |
noc='\e[0m' | |
_get_connection() { | |
echo -e "1)$red devnull$noc\n2)$red eduroam$noc\nSelect a connection [o=1, t=2, q=quit]: " | |
read otq | |
case $otq in | |
o) | |
sudo ip link set wlp7s0 down; sudo netctl start devnull | |
;; | |
t) | |
sudo ip link set wlp7s0 down; sudo netctl start eduroam | |
;; | |
q) | |
exit | |
;; | |
*) | |
printf "%s\n%s" "Select a connection" "o->one, t->two" | |
;; | |
esac | |
} | |
if [[ $active_connection ]]; then | |
echo -e "\nAlready connected to $red$active_connection$noc\n" | |
sleep 5 | |
else | |
_get_connection | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment