for loop
#!/bin/bash
for number in {1..10}
do
echo "$number "
done
exit 0
for i in 1 2 3 4 5
do
IS_LOCKED=`cat $LTE_AT_LOCK`
if [ "$IS_LOCKED" = "1" ]; then
echo "lte_tool.sh $1, LTE AT Locked, Sleep 2 Wait times: $i" > $OUT_PUT
else
return
fi
sleep 1
done
#!/bin/bash
for ((number=1;number < 100;number++))
{
if (( $number % 5 == 0 ))
then
echo "$number is divisible by 5 "
fi
}
exit 0
for FILE in $(ls /tmp); do
echo $FILE
done
while loop
while [ "$num" -gt 0 ]
do
num=`expr $num - 1`
ifconfig ra$num down 1>/dev/null 2>&1
done
while [ $((i++)) -lt $count ]; do
...
done
ls /etc | while read FILE; do
echo "FILE=$FILE"
done
until loop
#!/bin/bash
QUIT="quit"
USER_INPUT="a"
until [ "$QUIT" = "$USER_INPUT" ]; do
echo -n "請輸入文字(輸入quit離開): "
read USER_INPUT
echo "你輸入的是: $USER_INPUT"
echo ""
done