I have a list of files stored in txt file.
./test7
./test4
./test1
./test5
./test6
./test10
./test8
./test2
./test9
./test3
I want to run a command on all those files but I want to sleep 1 second after each two files are processed, eg:
cp ./test1 test1-backup
cp ./test2 test2-backup
sleep 1
cp ./test3 test3-backup
cp ./test4 test4-backup
sleep 1
...
cp ./test9 test9-backup
cp ./test10 test10-backup
Is there a way to achieve this by bash script? I would like to parametrize the amount of commands executed by 1 iteration (calling sleep 1). Also another problem is that real list of files has hundreds thousands of lines.