bascule wrote:

>i have posted this on newbie but had no repsonse,
>after playing around i have found that the section in my little script that 
>says `ls *.wav` is probably my problem, reading 'man ls' i changed it to `ls 
>-Q *.wav` but this didn't work, then i discovered something wierd,
>
>if i do:
>$ls -Q *.wav
>i get the following:
><snip>
>"11_move on.wav"                  "26_i don't know why.wav"
>"12_leon.wav"                     "27_a man's job.wav"
>"13_itch.wav"                     "28_it's too bad.wav"
>"14_wake up.wav"                  "29_do you love me.wav"
>"15_what generation are you.wav"
>
>i.e. a list of filenames with the ""around them, job done i thought, but to 
>test i did:
>$ for file in `ls -Q *.wav`;do echo "$file";done
>and this gave me:
><snip>
>"26_i
>don't
>know
>why.wav"
>"27_a
>man's
>job.wav"
>"28_it's
>too
>bad.wav"
>"29_do
>you
>love
>me.wav"
>
>as you can see, i get a list of each individual 'word' in the filenames, can 
>someone help or explain this for me?
>
>bascule
>
>----------  Forwarded Message  ----------
>
>Subject: Re: [newbie] filenames with spaces causing error in script
>Date: Thu, 13 Sep 2001 22:44:49 +0100
>From: bascule <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>
>i have also tried the following:
>$ for file in `ls *.wav`;do lame -b 256 -q 0 "$file" "`basename "$file"
>.wav`".mp3;done
>
>i think this is fine apart from the first line, i think this is feeding each
>seperate word in a filename as a filename to the lame command, i think that
>it might actually be complicated to return a list of files that have
>spacenames and assign each whole filename to a variable
>am i wrong?
>
>bascule
>
>On Thursday 13 September 2001 10:18 pm, I wrote:
>
>>hi,
>>i have used the following to convert some homemade wavs into mp3s:
>>$ for file in `ls *.wav`;do lame -b 256 -q 0 $file `basename $file
>>.wav`.mp3;done
>>
>>it works fine except for file names with spaces, i can't work out how to
>>rectify this, i have also tried:
>>$ for file in `ls *.wav`;do lame -b 256 -q 0 "$file" "`basename $file
>>.wav`.mp3";done
>>
>>and
>>$ for file in "`ls *.wav`";do lame -b 256 -q 0 "$file" "`basename $file
>>.wav`".mp3;done
>>
>>as you can see i've tried using "" around references to file names but this
>>hasn't helped, could someone please help me out
>>
>>tia
>>
>>bascule
>>

write something like that:

#!/bin/bash
IFS=$(echo -e "\n\r\t")
for wav_name in (ls *.wav) ; do
lame <options> "${wav_name}" "$(basename ${wav_name} .wav).mp3"
rm -f  "${wav_name}"  #add this line only if u want to erase your wav 
file after encoding!
done

but r u sure about -q O? the version i run doesn't accept 
them....(lame-3.22b-1)

bye
jipe





Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to