Candyrice/sh/values/wifi.sh

9 lines
286 B
Bash
Raw Normal View History

2024-08-01 17:18:07 +00:00
res=$(nmcli device wifi list | sed 's/\ \ \ */|/g' | grep "*" | cut -d"|" -f 3,6,8)
name=${res%%|*}
bars=${res##*|}
bars=$(( 4 - $(echo $bars | tr -dc "_" |wc -c) ))
speed=${res#*|}
speed=${speed%|*}
echo "{\"name\":\"$name\",\"speed\":\"$speed\",\"bars\":\"$bars\",\"icon\":\"\"}"