until
ステートメントまたはif
ステートメントがあるかどうかによって異なる結果になるのはなぜですか?"if"と "until"はbashスクリプトで異なる結果を示します
# compare dates
a=12
b=8
if [ $a -le $b ]; then
echo "it is not less than using if"
fi
until [ $a -le $b ]
do
echo "it is less than using until !?!?!?"
done
if
文は、彼らが完全に同じ条件であっても、失敗しますが、永遠にuntil
の文を印刷します。どうして?
ありがとうございます。これは本当に私の理解に役立ちます。
「until condition」は「while not条件」と同等です。すなわちwhile while condition == false – anishsane
unitlループは、conditionがfalseのときに実行されます。 http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_03.html –
は、おそらく条件文とループ構造に慣れることから始めます。そして、はるかに明確になります。 –