sh script for sge, first completed version