#!/bin/sh
The most basic usage of #for loop
for var in "hello" "xiao ta" "welcome to "
do
echo -n "$var "
done
echo
#Wildcard extension
for var in $(ls *.sh)
do
echo "$var"
done
#while loop, the following are the same as if and the condition
echo "please input secret"
read secret
while [ "$secret" != "xiao ta" ]
do
echo "try again"
read secret
done
#until loop is opposite to while, and the condition is false and executes
echo "please input text"
read text
until [ "$text" = "xiao ta" ]
do
echo "try again"
read text
done
exit 0