Skip to content

Instantly share code, notes, and snippets.

@hsali
Created November 16, 2016 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsali/03c2d3377733bcf691d3329a2e81297e to your computer and use it in GitHub Desktop.
Save hsali/03c2d3377733bcf691d3329a2e81297e to your computer and use it in GitHub Desktop.
Random play Music with mplayer in a specific folder
#!/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
@hsali
Copy link
Author

hsali commented Nov 16, 2016

Example to play music.
Go to the folder where your audio file placed.

Syntax:

   ./play_music.sh directory_path extension_type

###Example

 ./play_music.sh ./ mp3

@hsali
Copy link
Author

hsali commented Nov 18, 2016

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment