scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

commit c04498863e591792678d4facc81b07a1c082714c
parent 818acc5e752efeabaea46b6c5e60cb5bcbb7412b
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Fri, 20 Sep 2024 12:13:04 +0200

Fixed status-openbsd network

Diffstat:
Mstatus-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"