#!/bin/sh
INTERVAL=1
COUNT=0
while [ $COUNT -le 9 ]
do
(( COUNT++ ))
sleep $INTERVAL
echo "count is $COUNT"
done
在执行。
$ sh ascript
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found