Here is a bash script that works. It is basically what you have with a few tweaks:
#!/bin/bash set -o pipefail find . -type f -name "*.mp3" -print0 | while IFS= read -r -d '' file; do BITRATE=$(exiftool -AudioBitrate "$file" | grep -Eo '[0-9]+ kbps' | sed 's/ kbps//') if [[ $? -eq 0 ]] && [[ $BITRATE -ge 320 ]]; then echo $BITRATE "$file" fi done
In setting the $BITRATE variable I run exiftool through a pipe directly and use $(...) to capture the output. Then, in the conditional I check if the exiftool -> grep pipe was successful and the bitrate is sufficiently high using Bash's numeric comparison operators.
I've checked that it handles some random .mp3 files I have lying around, including ones with spaces in the name.