#!/bin/ksh for x in *.pl; do if [[ -f "$x" ]]; then ./what_you_want_to_do *.pl break fi done