#!/bin/bash for file in *.cpp do filename="${file%.*}" list="$list, $filename.o" echo -n "Compiling $filename..." g++ -c $file if [ $? = '0' ] then echo "OK" else echo "ERROR" fi done wait echo $list