Loops in Shell Scripts
Loops execute commands repeatedly.
For Loop
Example:
#!/bin/bash
for server in web1 web2 web3 do echo "Checking $server" done
Output:
Checking web1 Checking web2 Checking web3 While Loop
Example:
#!/bin/bash
count=1
while [ $count -le 5 ]
do
echo
Output:
1 2 3 4 5