5766 shaares
507 private links
507 private links
Infinite for Loops
You can also use this format of for loop to create an infinite loop. All you need do is remove all of the elements from the loop header, like this. This is "infinite.sh."
#!/bin/bash
for (( ; ; ))
do
echo "Press Ctrl+C to stop..."
sleep 1
done
You'll need to hit Ctrl+C to stop the loop.