I want to do something like:
for i in * do if test -d $i then cd $i; make clean; make; cd -; fi; done
And this
You can check whether the make has exited successfully by examining its exit code via the $? variable, and then have a break statement:
make
$?
break
... make if [ $? -ne 0 ]; then break fi