bin/time.sh (view raw)
1#!/usr/bin/env bash
2
3fg="$(xres color15)"
4light="$(xres color8)"
5
6raw_date="$(date +"%a, %d %b" | tr A-Z a-z)"
7raw_time="$(date +%I:%M)"
8
9time="%{F$light}time %{F$fg}$raw_time"
10date="%{F$light}date %{F$fg}$raw_date"
11
12while getopts dtn options
13do
14 case $options in
15 d)
16 printf "%s" "$date"
17 ;;
18 t)
19 printf "%s" "$time"
20 ;;
21 n)
22 printf "%s\n" "$raw_date"
23 printf "%s" "$raw_time"
24 esac
25done