Scripting problem! - TechRepublic
General discussion
October 3, 2002 at 04:14 AM
bmw

Scripting problem!

by bmw . Updated 23 years, 7 months ago

Hi,

I have RedHat Linux installed on on a crappy old laptop that I have hooked up to an amplifier, and I want to use it to play mp3 files that it finds in my ‘/mnt/music’ directory (it has lots of sub directories for each band).
What i want, is a script that will play mp3 files using a wildcard.
I am using ‘plaympeg’ to listen to the songs, and I have had a go at creating a script to do what i want ……

for file in `find /mnt/music -name “*REM*.mp3” -print2`
do
plaympeg “$file”
done

….. however, the script seems to have problems with songs with spaces in eg
REM – Orange Crush.mp3 fails as it says it can’t play “Orange” then can’t play “Crush” etc etc.

Can you see what I am doing wrong?
Is there a smarter way to do this? (I am sure there is!)

Thanks,

Ben.

This discussion is locked

All Comments