From 60052659b98832c78c902e4f27ecee2663d8e913 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 6 May 2026 08:30:49 +0200 Subject: Added scripts --- scripts/status-openbsd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 scripts/status-openbsd (limited to 'scripts/status-openbsd') diff --git a/scripts/status-openbsd b/scripts/status-openbsd new file mode 100755 index 0000000..6382053 --- /dev/null +++ b/scripts/status-openbsd @@ -0,0 +1,26 @@ +#!/bin/sh + +# Prints some status info to stdout. Includes: +# - date and time +# - battery +# - wifi (requires ifconfig on OpenBSD) + +# Usage: status [separator] + +sep=${1:-" | "} + +time=$(date +"%H:%M") +date=$(date +"%d %b") +battery="$(apm | grep -o '[^ ]*%')" +ifconfig="$(ifconfig athn0)" +network="$(echo "$ifconfig" | grep status | sed 's/.*status: //')" +if [ "$network" = "active" ]; then + 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