I have an array of numbers (1 2 3 4 5)
magicnumber=7
I want to say if the magic number is equal to a number found in the array or greater than the highest number in the array then do.
{array[@]} - contains numbers
highnum=the highest number from the array
for f in $dir "#f is file with a number in it"
do
"the number inside file f is pulled out and named filenum"
filenum
for i in ${array[@]}
do
if [ $i -eq $filenum ] || [ $filenum -gt $highnum ]
then
do this and end the "for i loop"
else
continue with loop
fi
done
done
{}button above the edit box to indent all by 4 spaces.breakstatement terminates the loop. Theelseclause is redundant since the loop will continue anyway. However, you could usecontinuein theelseclause to go to the next cycle of the loop.help breakin a bash shell will provide faster feedback then adding comments to an SO question.breakbreaks a single loop; to break 2 levels of loop, you'd saybreak 2. Similarly withcontinue.