aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-01-15 08:24:13 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2024-01-15 08:24:13 +0100
commit1f6141d910e35c9912bcec75ba20667c38437602 (patch)
tree10de84ad2ce5180458bba3d6f319085b489a0214
parentb55d1f0a3ec1d59e67f74de6173abec20cbb78ac (diff)
downloadscripts-1f6141d910e35c9912bcec75ba20667c38437602.tar.gz
scripts-1f6141d910e35c9912bcec75ba20667c38437602.zip
Fixed event on BSD
Diffstat (limited to '')
-rwxr-xr-xevent6
1 files changed, 4 insertions, 2 deletions
diff --git a/event b/event
index 754caa9..16991cf 100755
--- a/event
+++ b/event
@@ -46,9 +46,10 @@ datetoseconds() {
46 fi 46 fi
47} 47}
48 48
49today() { echo "$(date +'%Y-%m-%d') 00:00"; }
49dayplus() { 50dayplus() {
50 d="$1" 51 d="$1"
51 n="$(datetoseconds today)" 52 n="$(datetoseconds $(today))"
52 echo "$((n+d*60*60*24))" 53 echo "$((n+d*60*60*24))"
53} 54}
54monday() { d="$(date +%u)"; dayplus "$((1-d))"; } 55monday() { d="$(date +%u)"; dayplus "$((1-d))"; }
@@ -96,7 +97,8 @@ secondsline() {
96 97
97filterlines() { 98filterlines() {
98 while read -r line; do 99 while read -r line; do
99 s="$(datetoseconds $line)" 100 cleanline="$(echo "$line" | awk '{print $1, $2}')"
101 s="$(datetoseconds $cleanline)"
100 [ "$s" -ge "$1" ] && [ "$s" -lt "$2" ] && echo "$line" 102 [ "$s" -ge "$1" ] && [ "$s" -lt "$2" ] && echo "$line"
101 done 103 done
102} 104}

Generated with cgit - Back to sebastiano.tronto.net