How can write infinite shell that will run forever? May be I need a 5 second sleep between steps. Recently I have a issue with my routing table and I need to remove some route automatically every 5 minutes. I came up with a solution that runs every 4 minutes and clears unwanted routes.
There are a lot of different ways do express our solution one of them is when loop of bash.
$while true; do echo "test"; sleep 5; done
Here while true runs loop forever between do and done is run regularly but sleep 5 makes the script or each step to wait 5 seconds. We can cancel script with CTRL+C.
We can implement our solution with for loop.
$for (( ; ; )) do echo "test"; sleep 5; done