#!/bin/sh NUM=0 while [ -e myProg_$NUM.log ] do NUM=$((NUM+1)) done LOG=myProg_$NUM.log date > $LOG