mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -08:00
allow multiple arguments to dated
This commit is contained in:
parent
2debcff660
commit
890254b5ba
1 changed files with 4 additions and 6 deletions
10
sh/dated
10
sh/dated
|
@ -5,17 +5,15 @@
|
|||
# YES_ASH
|
||||
|
||||
dated() {
|
||||
local u=0
|
||||
local ts= u=0
|
||||
[ "$1" != -u ] || { shift; u=1; }
|
||||
argc $# -le 1 "$0" || return
|
||||
if [ $# = 0 ]; then
|
||||
# -u doesn't actually do anything here, but...
|
||||
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
|
||||
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 "$@"
|
||||
|
|
Loading…
Add table
Reference in a new issue