commit 156f6c0e5dbd2c8294d655e9629bf85d035a4167 from: Sven M. Hallberg date: Sat Jun 08 12:59:31 2024 UTC tl: make the script Linux compatible Use the GNU coreutils syntax for stat(1) if uname(1) says Linux. commit - ba7fa014d93988efab6b9fba4a63652d9a598447 commit + 156f6c0e5dbd2c8294d655e9629bf85d035a4167 blob - 64a1eeb7073ae4bc88a810a539102a59c7bc9c8e blob + 8908d9e8e7d7b434a863fc96613bb0b54782f9f5 --- tl +++ tl @@ -1,14 +1,20 @@ #!/bin/sh # "todo loop" -# pesco 2018-2019, isc license +# pesco 2018-2019, 2024; isc license +MTIME="stat -f %m" # file modification time [epoch seconds] +if [ "$(uname)" = Linux ] +then + MTIME="stat -c %Y" # GNU coreutils has to be different +fi + test -z "$TODO" && TODO=~/.todo test -z "$DONE" && DONE=~/.log t=0 while [ $t -eq 0 ] || sleep 1 do - s=$(stat -f %m "$TODO") || exit 1 + s=$($MTIME "$TODO") || exit 1 if [ $s -gt $t ] then @@ -18,7 +24,7 @@ do if [ -e "$DONE" ] then - r=$(stat -f %m "$DONE") + r=$($MTIME "$DONE") s=$(($r > $s ? $r : $s)) if [ $s -gt $t ] then