diff options
Diffstat (limited to 'status-openbsd')
| -rwxr-xr-x | status-openbsd | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/status-openbsd b/status-openbsd new file mode 100755 index 0000000..1f88b50 --- /dev/null +++ b/status-openbsd | |||
| @@ -0,0 +1,20 @@ | |||
| 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 | |||
| 10 | sep=${1:-" | "} | ||
| 11 | |||
| 12 | time=$(date +"%H:%M") | ||
| 13 | date=$(date +"%d %B %Y") | ||
| 14 | battery="$(apm | grep -o '[^ ]*%')" | ||
| 15 | network="$(ifconfig athn0 | grep status | sed 's/.*status: //')" | ||
| 16 | if [ "$network" = "active" ]; then | ||
| 17 | network="$(ifconfig athn0 | grep nwid | sed 's/.*nwid //;s/ chan.*//')" | ||
| 18 | fi | ||
| 19 | |||
| 20 | echo "$network$sep$battery$sep$date$sep$time" | ||
