This is how you create an infinite loop in bash to run a piece of code infinitely at defined intervals.
while [ 1 ]
# Your code goes here
# Modify sleep time (in seconds) as needed below
I needed such code to monitor the size of a file every 2 seconds.