file="$1" if [[ $file =~ \.bin$ ]] || [[ $file =~ \.hex$ ]]; then echo "OK" >&2 else echo "NOT OK" >&2 exit 2 fi