How to iterate through multiple file extension without caring about case sensitivity?
Use find:

find "$arg" -iname \*.txt -o -iname \*.h -o -iname \*.py|while read f;do :;done


Use IFS= read -r if the paths can end with spaces or contain backslashes.

Or install bash 4:

brew install bash;echo /usr/local/bin/bash|sudo tee -a /etc/shells;chsh -s /usr/local/bin/bash


Then:

 shopt -s globstar nocaseglob;for f in "$arg"/**/*.{txt,h,py};do :;done


shopt -s nocaseglob also works with bash 3.2.