Linux / UNIX: Bash Loop Forever
I need to cycles through a loop forever using for or while syntax. How do I set such loop under UNIX or Linux operating systems?
The syntax is as follows to cycle through a loop forever using while loop:
while [ 1 ]
OR use the following syntax:
while :; do echo 'Hit CTRL+C'; sleep 1; done
For loop example
To cycle through a loop forever using for loop:
for (( ; ; ))
echo "Pres CTRL+C to stop..."
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics: