Skip to content

Instantly share code, notes, and snippets.

@danog
Last active August 29, 2015 14:19
Show Gist options
  • Save danog/f45e9e993f47618f4a5f to your computer and use it in GitHub Desktop.
Save danog/f45e9e993f47618f4a5f to your computer and use it in GitHub Desktop.
MP3 Player script
#!/bin/bash
# Script to play mp3 files.
# By Daniil Gentili
if [ "$1" = "--help" ]; then echo "Music player by Daniil Gentili.
Usage: `basename $0` [ Options ] file1 file2 ...
If called with no arguments you will be asked to select the file(s) to play.
Options:
--help: Shows this extremely helpful message.
"
exit
fi
yatm='printf "\n####### Press q to skip the current track and Control-C to exit this program. ####### \n \n"; for f in $play; do echo $f | grep -q .mp3 && ft="$f" || ft="$f.mp3"; yatm "$ft";done'
if [ "$*" = "" ]; then
while [ $e = ""]; do
music=$(ls *.mp3 | cut -d'.' -f1)
echo "What audio file(s) do you wish to play?
$music"
read -p "Your selection(s): " play
eval "$yatm"
done
else play="$*"; eval $yatm;fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment