bufferTOD="$((SECONDS + $bufferTTL))";
lineCount=0;
# Consume stdin to fill buffer until buffer time-of-death (TOD) arrives
- while read -r line && [[ $SECONDS -lt "$bufferTOD" ]]; do
+ while read -r -t "$bufferTTL" line && [[ $SECONDS -lt "$bufferTOD" ]]; do
# Append line to buffer array
buffer+=("$line");
echo "DEBUG:Processing line:$lineCount";