find-ext-and.sh 218 B

1234567891011
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. display_help(){
  4. echo "Usage: ${0##*/} [ext] [command]"
  5. exit 2
  6. }
  7. [[ $# -lt 2 ]] && display_help
  8. find -type f -name "*.${1}" -print0 -exec "${@:2}" {} +