2017-12-01 00:21:33 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-06-01 21:19:37 -05:00
|
|
|
count=0
|
2018-02-16 07:44:07 -06:00
|
|
|
disconnected="/"
|
2018-02-26 05:25:52 -06:00
|
|
|
disconnected2="\\"
|
|
|
|
wireless_connected=""
|
2018-02-16 07:44:07 -06:00
|
|
|
ethernet_connected=""
|
2017-12-05 21:50:28 -06:00
|
|
|
|
2017-12-01 00:21:33 -06:00
|
|
|
while true; do
|
2018-06-01 21:19:37 -05:00
|
|
|
if ping -c1 www.google.com &>/dev/null; then
|
|
|
|
if (( count < 1 )); then
|
|
|
|
ID="$(ip link | awk '/state UP/ {print $2}')"
|
|
|
|
((count++))
|
|
|
|
fi
|
2018-02-26 23:01:09 -06:00
|
|
|
if [[ $ID == e* ]]; then
|
2018-05-12 13:00:19 -05:00
|
|
|
echo "$ethernet_connected" ; sleep 20
|
2018-02-16 07:44:07 -06:00
|
|
|
else
|
2018-05-12 13:00:19 -05:00
|
|
|
echo "$wireless_connected" ; sleep 20
|
2018-02-16 07:44:07 -06:00
|
|
|
fi
|
2017-12-07 22:20:42 -06:00
|
|
|
else
|
2018-02-26 05:25:52 -06:00
|
|
|
echo "$disconnected" ; sleep 0.6
|
|
|
|
echo "$disconnected2" ; sleep 0.6
|
2017-12-07 22:20:42 -06:00
|
|
|
fi
|
2017-12-01 00:21:33 -06:00
|
|
|
done
|