I wonder how to stop further loop iterations when conditions gets false e.g.
This file.txt contains the following structure :
1
2
3
4
5
6
7
8
9
10
How to stop iteration when if statement gets false ?
for n in `cat file.txt`
do
if (( n<=5 ))
then
print "$n"
else
# Here I want to stop iteration
fi
done
Thx fo r help.
---------- Post updated at 11:36 PM ---------- Previous update was at 11:35 PM ----------
I've got it.
for n in `cat file.txt`
do
if (( n<=5 ))
then
print "$n"
else
# Here I want to stop iteration
while true
do
break
done
fi
done