Shell continue循环

[oracle@june ~]$ cat continue.sh 
for i in  a b c d e f g
do
if  [ "$i" = "c" ]
then
echo xxxxxxxxxxxxxx
echo "跳过的字符为"$i
continue
fi
done
[oracle@june ~]$ sh -x ./continue.sh 
+ for i in a b c d e f g
+ '[' a = c ']'
+ for i in a b c d e f g
+ '[' b = c ']'
+ for i in a b c d e f g
+ '[' c = c ']'
+ echo xxxxxxxxxxxxxx
xxxxxxxxxxxxxx
+ echo $'\314\370\271\375\265\304\327\326\267\373\316\252c'
跳过的字符为c
+ continue
+ for i in a b c d e f g
+ '[' d = c ']'
+ for i in a b c d e f g
+ '[' e = c ']'
+ for i in a b c d e f g
+ '[' f = c ']'
+ for i in a b c d e f g
+ '[' g = c ']'


continue 跳过当前循环步,回到循环开始

posted @ 2014-05-13 10:12  czcb  阅读(291)  评论(0编辑  收藏  举报