Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 2487

Raspberry Pi OS • Re: Bash $SECONDS not working on Pi 4

$
0
0
Are you using 32-bit or 64-bit OS?

I can't reproduce this issue. I used this script that has a random sleep of between 20 and 139 seconds

Code:

#!/bin/bashASTART=$SECONDSecho "Starting with $ASTART seconds on the counter"(( DELAY = 20 + ( RANDOM % 120 ) ))echo "Sleeping for $DELAY seconds"sleep $DELAYecho "$(( $SECONDS - $ASTART )) seconds."
and it gave the expected results

Code:

rpdom@raspberrypi:~ $ ./timecheck.sh Starting with 0 seconds on the counterSleeping for 112 seconds112 seconds.
I tried on both 32-bit and 64-bit Raspberry Pi OS (Bookworm) Lite ,on the same Pi 4B.

OS was freshly written from the latest image and fully updated.

Statistics: Posted by rpdom — Tue Jul 16, 2024 9:01 am



Viewing all articles
Browse latest Browse all 2487

Trending Articles