Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple script to play random mp3s in a folder
#!/bin/bash -e
PLAYER="mpv -vo null"
#PLAYER="mpg321"
MUSIC=$(find . -regextype posix-extended -iregex '.*(m4a|mp3|mp4|aac)$' | sort -R)
IFS=$'\n'
for file in $MUSIC
do
IFS=$' '
$PLAYER "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment