while [ 1 ] do sleep 60 lsof | grep $log_file > /dev/null 2>&1 echo $? if [ "$?" = "1" ] then echo "$log_file is currently not in use!" break fi done