mirror of
https://github.com/notwa/rc
synced 2024-11-05 06:39:02 -08:00
16 lines
444 B
Bash
Executable file
16 lines
444 B
Bash
Executable file
#!/usr/bin/env sh
|
|
# compat: +ash +bash +dash +hush -ksh +mksh +oksh +osh +posh +yash +zsh
|
|
|
|
dated() {
|
|
local ts= u=0
|
|
[ "$1" != -u ] || { shift; u=1; }
|
|
if [ $# = 0 ]; then
|
|
# -u doesn't actually do anything here, but...
|
|
if [ $u = 1 ]; then date -u '+%s'; else date '+%s'; fi
|
|
fi
|
|
for ts; do
|
|
if [ $u = 1 ]; then date -u -d '@'"$ts"; else date -d '@'"$ts"; fi
|
|
done
|
|
}
|
|
|
|
[ -n "${preload+-}" ] || dated "$@"
|