Last active
August 17, 2019 22:43
-
-
Save kirelagin/6a575ad6dcb5be8540dc70d8992f926a to your computer and use it in GitHub Desktop.
Monitor signal strength (RSSI) of the active Wi-Fi network on macOS
This file contains 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 | |
# SPDX-FileCopyrightText: 2019 Kirill Elagin <https://kir.elagin.me/> | |
# SPDX-License-Identifier: MPL-2.0 | |
### | |
# | |
# Monitor signal strength (RSSI) of the active Wi-Fi network on macOS. | |
# | |
# Usage: | |
# rssi.sh | |
# | |
# https://gist.github.com/kirelagin/6a575ad6dcb5be8540dc70d8992f926a | |
### | |
airport() { /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport "$@"; } | |
plistb() { /usr/libexec/PlistBuddy "$@"; } | |
tmpf=$(mktemp -t rssi.sh) # PlistBuddy can't read from stdin :/ | |
tput civis # hide the cursor | |
trap 'tput cnorm; rm -f "$tmpf"; trap - INT; kill -s INT "$$"' INT | |
while true; do | |
airport -xI > "$tmpf" | |
sig=$(plistb -c 'Print :RSSI_CTL_AGR' "$tmpf"); printf "%s\r" "$sig" | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment