summaryrefslogtreecommitdiff
path: root/scripts/status-openbsd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/status-openbsd')
-rwxr-xr-xscripts/status-openbsd26
1 files changed, 26 insertions, 0 deletions
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 @@
1#!/bin/sh
2
3# Prints some status info to stdout. Includes:
4# - date and time
5# - battery
6# - wifi (requires ifconfig on OpenBSD)
7
8# Usage: status [separator]
9
10sep=${1:-" | "}
11
12time=$(date +"%H:%M")
13date=$(date +"%d %b")
14battery="$(apm | grep -o '[^ ]*%')"
15ifconfig="$(ifconfig athn0)"
16network="$(echo "$ifconfig" | grep status | sed 's/.*status: //')"
17if [ "$network" = "active" ]; then
18 nwid="$(echo "$ifconfig" | grep nwid | sed 's/.*nwid //;s/ chan.*//')"
19 if [ -z "$nwid" ]; then
20 nwid="$(echo "$ifconfig" | grep ieee80211 | \
21 sed 's/.*ieee80211: join //' | sed 's/ chan.*//')"
22 fi
23fi
24network="$(printf "%.20s" "$nwid")" # Make it shorter
25
26echo "$network$sep$battery$sep$date$sep$time"

Generated with cgit - Back to sebastiano.tronto.net