For each file in a directory, I want to execute a python program.
#!/bin/bash
for file in mp3/* ; do
if [[ "$file" == *.wav ]]; then
python wav.py --file $file
elif [[ "$file" == *mp3 ]]; then
python mp3.py --file $file
fi
done
How can I modify this bash script such that the files are taken in random order?
An approach may be to load the files from the directory (recursively) into a list and shuffle the list first. Sadly, I'm not too gifted in bash scripting.