#!/bin/bash
-
# Desc: Template to display date
yell() { echo "$0: $*" >&2; } #o Yell, Die, Try Three-Fingered Claw technique
dateShort(){
# Desc: Date without separators (YYYYmmdd)
# Usage: dateShort ([str date])
- # Version: 1.1.1
+ # Version: 1.1.2
# Input: arg1: 'date'-parsable timestamp string (optional)
# Output: stdout: date (ISO-8601, no separators)
- # Depends: yell
+ # Depends: bash 5.0.3, date 8.30, yell()
local argTime timeCurrent timeInput dateCurrentShort
argTime="$1";
else
### F: Time argument not valid; exit
yell "ERROR:Invalid time argument supplied. Exiting."; exit 1;
- fi
- fi
+ fi;
+ fi;
# Construct and deliver separator-les date string
dateCurrentShort="$(date -d "$timeInput" +%Y%m%d)"; # Produce separator-less current date with resolution 1 day.
echo "$dateCurrentShort";