I'm trying to figure something out that relates to the Bash shell and my Bash script. So I have a script that uses ffprobe to process data for a bunch of audio files and print out stuff I can parse to check audio parameters and quality.
As a lazy way to run the script, I've run it like this:
Code: Select all
ffprobe-audio-quality-check.sh *.{flac,mp3,wav}
In the beginning of my script, I have also set a default argument to use, like this:
Code: Select all
if [ $# -lt 1 ]; then
set -- *.{flac,mp3,wav}
fi
Code: Select all
for f in "$@"; do
# Print the filename
printf "%s\n" "$f"
...
<do stuff>
done
What I would like to do is prevent the errors somehow--or maybe look at a better way of doing this. I know there is a possibility of maybe using the "find" command instead of a "for" loop, because it can process a list of files better. But could I do this and still pass in arguments such as a glob or list of files like "*.{flac,mp3,wav}" without any errors?
Whatever I'm doing, it's not working out. Like the expansion and glob stuff in Bash is just still confusing to me on how it works in 100% detail. Any help, or even some ideas, is much appreciated.