aboutsummaryrefslogtreecommitdiff
path: root/lemonbar/bin/get_network_info.sh
blob: f85b0f681366e73e847144051e570efd51cc219a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh


for DEV in `ip -o addr | awk '{if($2 != "lo" && $3 == "inet"){print $2}}'`
do
	SSID=""
	OUTPUT=""
	ADDR=`ip addr show dev "$DEV" | grep -E "inet[^6]" \
	| awk '{print $2}'`
	MATCH=`expr "$DEV" : "^wlp"`
	if test "$MATCH" -gt 0
	then
		SSID=`iw dev "$DEV" link | grep SSID | awk '{print $2}'`
		SSID="$SSID: "
	fi

	if test -n "$OUTPUT"
	then
		OUTPUT="$OUTPUT | ($DEV) $SSID$ADDR"
	else
		OUTPUT="($DEV) $SSID$ADDR"
	fi
done

echo "$OUTPUT"