Let's say we have for loop as follow:#!/bin/bashfor i in $(cat test_file); do echo $idoneThe content of text file is names of folders in a parent folderIf the text_file contains 10000 entries (i.e. variable i), how can I tell for loop to sleep 10 seconds between every 10 echos.In other words when for loop reads the variable i in the text_file how can I control the number of variables that for loop can run every specific period of time? So the output as follow:   Variable #1   Variable #2   Variable #3   .   .   .   .   sleep 10    Variable #11    Variable #12    Variable #13   .   .       .
How to control for loop?
bash
Use the following bash script (to sleep 10 seconds between every 10 echos):test.sh is a test name of the script#!/bin/bashwhile ((++i)); read -r linedo    echo $line    if (( $i % 10 == 0))     then        sleep 10    fidone < $1Usage:bash test.sh test_filewhile ((++i)) - will increment i counter each time when read -r line returns a line from the inputif (( $i % 10 == 0)) - checks if current line number i is divisible by 10 (means that the execution flow reaches next 10 lines)sleep 10 - pauses the script for 10 seconds