3 ipv4
=$
(ip
-o route get
8.8.8.8 |
sed -e 's/^.* src \([^ ]*\) .*$/\1/')
4 ipv6
=$
(ip
-o route get
2001:4860:4860::8888 |
sed -e 's/^.* src \([^ ]*\) .*$/\1/')
7 dev
=$
(ip
-o route get
2001:4860:4860::8888 |
sed -e 's/^.* dev \([^ ]*\) .*$/\1/')
10 dev
=$
(ip
-o route get
8.8.8.8 |
sed -e 's/^.* dev \([^ ]*\) .*$/\1/')
13 if [ $dev = $1 ]; then
15 elif [ $dev = $2 ]; then
16 ssid
=$
(iw dev wlp62s0 info |
sed -n 's/^.*ssid \([^ ]*\)/\1/p')
17 signal
=$
(iw dev wlp62s0 link |
sed -n 's/^.*signal: \([^ ]*\).*/\1/p')
18 if [ $signal -gt -35 ]; then
19 echo " \x02$ssid (\x03$signal dBm\x02)\x01 : $ip\x01"
20 elif [ $signal -gt -60 ]; then
21 echo " \x02$ssid (\x04$signal dBm\x02)\x01 : $ip\x01"
22 elif [ $signal -gt -75 ]; then
23 echo " \x02$ssid (\x05$signal dBm\x02)\x01 : $ip\x01"
25 echo " \x02$ssid (\x06$signal dBm\x02)\x01 : $ip\x01"
28 echo "\x06Not connected\x01"