From c04498863e591792678d4facc81b07a1c082714c Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 20 Sep 2024 12:13:04 +0200 Subject: Fixed status-openbsd network --- status-openbsd | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/status-openbsd b/status-openbsd index 1f88b50..6382053 100755 --- 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" -- cgit v1.3