From 500da620557e19c334882e50ffbd92d6e53a4b76 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 10 Jul 2024 11:51:20 +0200 Subject: status for OpenBSD --- status-openbsd | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 status-openbsd (limited to 'status-openbsd') diff --git a/status-openbsd b/status-openbsd new file mode 100755 index 0000000..1f88b50 --- /dev/null +++ b/status-openbsd @@ -0,0 +1,20 @@ +#!/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 %Y") +battery="$(apm | grep -o '[^ ]*%')" +network="$(ifconfig athn0 | grep status | sed 's/.*status: //')" +if [ "$network" = "active" ]; then + network="$(ifconfig athn0 | grep nwid | sed 's/.*nwid //;s/ chan.*//')" +fi + +echo "$network$sep$battery$sep$date$sep$time" -- cgit v1.3