How to Run a Shell Script in Infinite Loop
You can run a shell script in infinite loop by using while loop.
#!/bin/bash while true do echo "Press CTRL+C to stop the script execution" # Enter your desired command in this block. done
You can also do this using below inline command
while true; do echo 'Press CTRL+C to stop the script execution'; done
You can also run an infinite loop in the background
while /bin/true; do something_in_the_background done &
Reference:
https://unix.stackexchange.com/questions/223778/how-to-run-an-infinite-loop-in-the-background
(Visited 4,884 times, 6 visits today)