current date in ISO format, and optionally the time in 12 hour format
today.sh edited
12 lines 237 B view raw
1#!/usr/bin/env bash 2 3# current date in ISO format 4if [ $# -eq 0 ]; then 5 echo -e "$(date '+%Y-%m-%d')" 6fi 7 8# if you also want time then supply `time` arg: 9# today time 10if [ "$1" == "time" ]; then 11 echo -e "$(date '+%Y-%m-%d_%I:%M%p')" 12fi