I am new to bash scripting and started out with a few sample scripts.
One is:
#!/bin/bash
SECONDS=5
i=1
while true
do
echo "`date`: Loop $i"
i=$(( $i+1 ))
sleep $SECONDS
done
This results in:
Sunday 10 May 15:08:20 AEST 2020: Loop 1
Sunday 10 May 15:08:25 AEST 2020: Loop 2
Sunday 10 May 15:08:35 AEST 2020: Loop 3
Sunday 10 May 15:08:55 AEST 2020: Loop 4
... and is not what I expected or wanted the script to do.
Why would the seconds double, every time it runs through the loop
bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>