Bash While Loop
This topic is about the While Loop on Unix/Linux bash environment.Following is the sample:while [ condition ]
do
command1
command2
command3
if [ condition ]
command1
fi
done
-------------------------
#!/bin/bash
x=1
while [ $x -le 5 ]
do
echo "Welcome $x times"
x=$(( $x + 1 ))
done
-------------------------
result will be like this:
Welcome 1 times
Welcome 2 times
Welcome 3 times
Welcome 4 times
Welcome 5 times
页:
[1]