for (( i = 0; i < 300000; i++ )) do cmd=$(dcat -f ext -o 803439 hda $i | grep "FLAG12") if $cmd then echo $i exit fi done