Loops
for loops and while loop in shell scripting
For Loops:
#!/bin/sh
for i in 1 2 3 4 5
do
echo "Looping ... number $i"
done#!/bin/sh
for i in hello 1 * 2 goodbye
do
echo "Looping ... i is set to $i"
doneWhile Loops:
#!/bin/sh
INPUT=hello
while [ "$INPUT" != "bye" ]
do
echo "Please type something in (bye to quit)"
read INPUT
echo "You typed: $INPUT"
doneLast updated