scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

commit 1f6141d910e35c9912bcec75ba20667c38437602
parent b55d1f0a3ec1d59e67f74de6173abec20cbb78ac
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon, 15 Jan 2024 08:24:13 +0100

Fixed event on BSD

Diffstat:
Mevent | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/event b/event @@ -46,9 +46,10 @@ datetoseconds() { fi } +today() { echo "$(date +'%Y-%m-%d') 00:00"; } dayplus() { d="$1" - n="$(datetoseconds today)" + n="$(datetoseconds $(today))" echo "$((n+d*60*60*24))" } monday() { d="$(date +%u)"; dayplus "$((1-d))"; } @@ -96,7 +97,8 @@ secondsline() { filterlines() { while read -r line; do - s="$(datetoseconds $line)" + cleanline="$(echo "$line" | awk '{print $1, $2}')" + s="$(datetoseconds $cleanline)" [ "$s" -ge "$1" ] && [ "$s" -lt "$2" ] && echo "$line" done }