16 lines
374 B
Bash
Executable file
16 lines
374 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
usage() {
|
|
echo "Usage:"
|
|
echo " at <DATE> && command..."
|
|
}
|
|
|
|
[[ -z "$1" ]] && { echo "Error: No DATE argument provided." >&2; usage; exit 1; }
|
|
|
|
d="$(date -d "${@}" +%s)"
|
|
while [[ "$d" -ge "$(date +%s)" ]]; do
|
|
_dt=$((d - $(date +%s)))
|
|
days=$((_dt / 86400))
|
|
echo -ne "\rTime Remaining: ${days}d $(date -u --date @$((_dt)) +%H:%M:%S) ";
|
|
sleep 0.1
|
|
done |