The following program implements a simple mp3 playback function. You can set the path to search all mp3 files and play them in sequence.
#! /Bin/sh # very simple example shell script for mp3 player #2014-5-6 by slwang # search all mp3 files and play the song path1 in sequence = ~ /Musicpath2 = ~ /Downloadstemp_file =/tmp/temp_files $ musicset = "" menu_choice = "" isnext = "n" trap 'rm-f $ temp_file & audacious-S' EXITset_menu_choice () {clearecho "mp3 player menu:-" echo "p) play" echo "u) pause" echo "s) stop" echo "n) next" echo "c) count "echo" l) list "echo" q) quit "echo" please input: \ c "read menu_choice} clearecho" welcome to mp3 player "sleep 1IFS =" "find $ path1 $ path2-name *. mp3-print> $ temp_filemusicset = $ (cat $ temp_file) # more $ musicset> $ temp_filefor music in $ musicsetdoecho "Beign to play $ music" audacious-h $ musicisnext = "n" while ["$ isnext" = "n"] doset_menu_choicecase $ menu_choice indium) audacious-p; u) audacious-u; s) audacious-s; n) isnext = "y"; c) IFS = "" set $ (wc-l $ temp_file) lines = $1 echo "total include $ lines songs" echo "press return" IFS = "" read x; l) more $ temp_fileecho "press return" read x; q) exit 0; esacdonedoneIFS = "rm-f $ temp_fileaudacious-secho" finished "exit 0
(Reprinted please indicate the author and Source: http://blog.csdn.net/awakewind is not allowed for commercial use)