mirror of
https://github.com/notwa/rc
synced 2024-04-27 09:53:24 -07:00
allow multiple arguments to dated
This commit is contained in:
parent
2debcff660
commit
890254b5ba
10
sh/dated
10
sh/dated
|
@ -5,17 +5,15 @@
|
||||||
# YES_ASH
|
# YES_ASH
|
||||||
|
|
||||||
dated() {
|
dated() {
|
||||||
local u=0
|
local ts= u=0
|
||||||
[ "$1" != -u ] || { shift; u=1; }
|
[ "$1" != -u ] || { shift; u=1; }
|
||||||
argc $# -le 1 "$0" || return
|
|
||||||
if [ $# = 0 ]; then
|
if [ $# = 0 ]; then
|
||||||
# -u doesn't actually do anything here, but...
|
# -u doesn't actually do anything here, but...
|
||||||
if [ $u = 1 ]; then date -u '+%s'; else date '+%s'; fi
|
if [ $u = 1 ]; then date -u '+%s'; else date '+%s'; fi
|
||||||
else
|
|
||||||
if [ $u = 1 ]; then date -u -d '@'"$1"; else date -d '@'"$1"; fi
|
|
||||||
fi
|
fi
|
||||||
|
for ts; do
|
||||||
|
if [ $u = 1 ]; then date -u -d '@'"$ts"; else date -d '@'"$ts"; fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
|
|
||||||
eval ${preload:-preload} argc
|
|
||||||
[ -n "${preload+-}" ] || dated "$@"
|
[ -n "${preload+-}" ] || dated "$@"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user