utilies

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3440adadd691f266b971ec4694a6e2878471ca85
parent 937836b8b1791b078b8126a9e0ffde0b24bcba99
Author: Taco-C <perian.forod@gmail.com>
Date:   Thu,  2 Jul 2020 00:13:32 +0200

Add ordur

Diffstat:
MREADME.md | 1+
Aordur | 38++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -7,6 +7,7 @@ A handful of (useful) scripts for unix-like systems. | `dugrep` | `rofi` or `dmenu` | `du` files in home directory, `grep` file extention, then open in some program. | | `ealis.sh` | | Experimental Arch Linux Install Script for VirtualBox. | | `hangrep` | go (building) | From standard input, filter out single chinese characters to standard output. | +| `ordur` | | Print the time as text. | | `update-stagit.sh` | [stagit](https://git.codemadness.org/stagit/file/README.html) | Makes static html pages for all repos in `/srv/git/` into `/srv/http/`, and an index page. | | `wiktionaire` | `rofi` or `dmenu`, `surf` or another web browser. | Search for word on Wiktionary from the desktop. | diff --git a/ordur b/ordur @@ -0,0 +1,38 @@ +#!/bin/sh + +m="$(date '+%_M' | tr -d ' ' )" + +if [ $m = "0" ]; then + M="" +elif [ $m -lt "15" ]; then + M="$m over" +elif [ $m -eq "15" ]; then + M="Kvart over" +elif [ $m -lt "30" ]; then + d="$(expr 30 - $m)" + M="$d på halv" +elif [ $m -eq "30" ]; then + M="Halv" +elif [ $m -lt "45" ]; then + d="$(expr $m - 30)" + M="$d over halv" +elif [ $m -eq "45" ]; then + M="Kvart på" +else + d="$(expr 60 - $m)" + M="$d på" +fi + +h="$(date '+%_I' | tr -d ' ')" +[ $m -gt "15" ] && h="$(date -d '1 hour' '+%_I' | tr -d ' ')" + +the_time="$M $h" + +while getopts nd o; do + case $o in + n) the_time="$the_time på $(date '+%A')";; + d) the_time="$the_time den $(date '+%_d. %B')";; + esac +done + +echo "$the_time"