#!/bin/bash if [ $# -ne 2 ]; then echo "Usage myScript dirName extension" exit 0 fi if [ ! -d "$1" ]; then echo "Directory $1 does not exist. Aborting ... " exit 0 fi for file in "$1"/*; do if [[ $file == *.$2 ]]; then echo $file fi done