commit 31a433b6a68cf924b70039abc6464453c323acf2 parent e159d98f4389721d7a5e0c37cba3227dab3cb447 Author: Sebastiano Tronto <sebastiano@tronto.net> Date: Sun, 29 Sep 2024 21:32:11 +0200 Merge branch 'master' of tronto.net:scripts Diffstat:
M | status-openbsd | | | 12 | +++++++++--- |
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/status-openbsd b/status-openbsd @@ -10,11 +10,17 @@ sep=${1:-" | "} time=$(date +"%H:%M") -date=$(date +"%d %B %Y") +date=$(date +"%d %b") battery="$(apm | grep -o '[^ ]*%')" -network="$(ifconfig athn0 | grep status | sed 's/.*status: //')" +ifconfig="$(ifconfig athn0)" +network="$(echo "$ifconfig" | grep status | sed 's/.*status: //')" if [ "$network" = "active" ]; then - network="$(ifconfig athn0 | grep nwid | sed 's/.*nwid //;s/ chan.*//')" + nwid="$(echo "$ifconfig" | grep nwid | sed 's/.*nwid //;s/ chan.*//')" + if [ -z "$nwid" ]; then + nwid="$(echo "$ifconfig" | grep ieee80211 | \ + sed 's/.*ieee80211: join //' | sed 's/ chan.*//')" + fi fi +network="$(printf "%.20s" "$nwid")" # Make it shorter echo "$network$sep$battery$sep$date$sep$time"