From 1e331865af3b37b64056f8f3c09f8ddc33077386 Mon Sep 17 00:00:00 2001 From: Narvin Singh Date: Sun, 27 Dec 2020 22:13:52 -0500 Subject: [PATCH] Feat: Date/time module --- module/dt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 module/dt diff --git a/module/dt b/module/dt new file mode 100755 index 0000000..576591a --- /dev/null +++ b/module/dt @@ -0,0 +1,17 @@ +#!/bin/bash + +run () { + # Customizable configuration constants + local -r DEFAULT_FMT='%a %d %I:%M%p' + local -r DEFAULT_PRE='' + local -r DEFAULT_SUF='' + + local -r fmt="${1:-${DEFAULT_FMT}}" + local -r pre="${2-${DEFAULT_PRE}}" + local -r suf="${3-${DEFAULT_SUF}}" + + printf '%b%b%b' "${pre}" "$(date +"${fmt}")" "${suf}" +} + +run "$@" +