Bascule,

Spaces in filenames are a major pain for shell scripts
for precisely the reason you suggest.  Unfortunately,
I'm currently on a business trip in Korea, so am a
week away from getting back to my Linux box at home to
give you a more definitive answer.  However, first
reaction is to try something with awk as follows:

ls *.wav | awk .....

In that way, ls will return one file name per line
(i.e. separated by \n) on which you can then do all
sorts of things in awk (including running commands
like lame).  

Sorry this is vague - it's 13 years since I've written
an awk script.  Have a play, read the man and if
you're still not cutting it, let me know and I'll have
a play next weekend.

Good luck!
Ron.

p.s. trickier than spaces is to create a file called *
(it's possible!) and then asking a Unix neophyte to
try to delete it (and nothing else in the directory! 
what fun ;-))!


--- bascule <[EMAIL PROTECTED]> wrote:
> 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
> 
> > Want to buy your Pack or Services from
MandrakeSoft?
> 
> Go to http://www.mandrakestore.com
> 


__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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

Reply via email to