Created
November 15, 2016 18:18
-
-
Save hsali/1ae2daaed99f153640f7996b69c108d3 to your computer and use it in GitHub Desktop.
Play random audio files from command line. It is mplayer which will play music command line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" = "" ]; then | |
echo "no directory defined!" | |
exit | |
fi | |
if [ "$2" = "" ]; then | |
echo "no file extension defined!" | |
exit | |
fi | |
while [ 1 ] | |
do | |
FILE=$(cd ${1}; find * | grep ${2}$ | shuf -n 1) | |
path1="$1$FILE" | |
/usr/bin/mplayer "$path1" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you don't this command installed in your system. then first install it. using this command.
see the manual or help using command.
or