#!/bin/bash # # Count all .sub images # Usage: count-images.sh DIR DIR=$1 if [ ! -d "$DIR" ]; then echo "Usage: count-images.sh DIR" exit 1 fi find "${DIR}" -name '*.jpg' | wc -l