break ループ 抜け出す 出て行く
構文
break [n]
オプション
[n] n重ループから出て行く。
説明
breakコマンドは、ループ(for,select,until,while)から
出て行くコマンドです。
break [n]
Exit from within a for, while, until, or select loop. If n is
specified, break n levels. n must be ? 1. If n is greater than
the number of enclosing loops, all enclosing loops are exited. The
return value is 0 unless the shell is not executing a loop when
break is executed.@
使用例
whileループを終わりにする。
while [ ! -e file_01.txt ]
do
touch file_01.txt
if [ -e file_01.txt ]
then
echo "make file" >>log.txt
break
echo "break" >>log.txt
fi
done
「この記事は役に立ちました。」という場合には
ブログランキングボタンをクリックしていただけると大変、助かります。
●ブログランキング
構文
break [n]
オプション
[n] n重ループから出て行く。
説明
breakコマンドは、ループ(for,select,until,while)から
出て行くコマンドです。
break [n]
Exit from within a for, while, until, or select loop. If n is
specified, break n levels. n must be ? 1. If n is greater than
the number of enclosing loops, all enclosing loops are exited. The
return value is 0 unless the shell is not executing a loop when
break is executed.@
使用例
whileループを終わりにする。
while [ ! -e file_01.txt ]
do
touch file_01.txt
if [ -e file_01.txt ]
then
echo "make file" >>log.txt
break
echo "break" >>log.txt
fi
done
ブログランキングボタンをクリックしていただけると大変、助かります。
●ブログランキング



