Unix-commands-continue

提供:Dev Guides
移動先:案内検索

continue-Unix、Linuxコマンド

NAME

*continue* -for、while、until、またはselectループを囲む次の反復を再開します。

概要

continue [n]

オプション

Tag Description
[n] If n is supplied, the nth enclosing loop is exited. n must be greater than or equal to 1. The return status is zero unless n is not greater than or equal to 1.

continueを使用するユーティリティクラスを作成します。

#continuesample
for myloop in 1 2 3 4 5
do
  echo -n "$myloop"
  if [ "$myloop" -eq 3 ]
   then
   continue # Skip rest of this particular loop iteration.
  fi
done

ユーティリティを実行する

$ chmod a+x continuesample
$ ./continuesample
1245

link:/cgi-bin/printpage.cgi [__印刷]