if [ $# -ne 1 ] then echo "Usage: $0 path" exit 1 fi cd $1 for i in `ls -1 $1` do if [ `basename $i .c` = $i -a `basename $i .h` = $i -a -f $i ] then t=$(grep -e '//;' -e '/*;' $i) echo for file $i : output is $t fi done output: [cjoudr][troy][~] sh suffixer . for file output : output is for file test2 - is 12;3//sdfsdf dsf;sdf/*sfsdfds for file suffixer : output is t=$(grep -e '//;' -e '/*;' $i) for file suffixer~ : output is t=$(grep -e '//;' -e '/*;' $i) for file test2 : output is 12;3//sdfsdf dsf;sdf/*sfsdfds [cjoudr][troy][~]