[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Handle each file at a time in loop?



$ ls
convert.sh   Track 1.wav  Track 3.wav  Track 5.wav  Track 7.wav  Track 9.wav
Track 1.mp3  Track 2.wav  Track 4.wav  Track 6.wav  Track 8.wav

So, you can see there are file names with spaces in them. I have
written a script like this to handle one file name at a time.

for file in `ls *.wav`
do
    echo $file
done

Of course, this doesn't do what I need. The names are split wherever
there are spaces.

$ sh convert.sh
Track
1.wav
Track
2.wav
Track
3.wav
Track
4.wav
Track
5.wav
Track
6.wav
Track
7.wav
Track
8.wav
Track
9.wav

What is the right way to do this?


Reply to: