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

Re: Bash recursing mp3.2.ogg conversion



Rodolfo Alcázar wrote:
> for f in $(find . -name "*mp3"); do command-mp3-2-ogg $f; done

Bill Gradwohl suggested:
> Put double quotes around the $f as - "$f" - to force file names that
> include spaces to be treated properly.

Rodolfo objected:
> NOP. See what hapens with an echo, so you can see the output.
> 
> $ for f in $(find . -name "*mp3"); do echo command-mp3-2-ogg "$f"; done
> 
> command-mp3-2-ogg ./Sting/Englishman
> command-mp3-2-ogg In
> command-mp3-2-ogg New
> command-mp3-2-ogg York.mp3
> command-mp3-2-ogg ./Sting/The
> command-mp3-2-ogg Hounds
> command-mp3-2-ogg Of
> command-mp3-2-ogg Winter.mp3

[james kendrick Graham Kendrick]$ IFS="
> "
[james kendrick Graham Kendrick]$ for f in $(find . -name "*mp3"); do echo command-mp3-2-ogg "$f"; done
command-mp3-2-ogg ./How Long.mp3
command-mp3-2-ogg ./Do Something Beautiful.mp3
command-mp3-2-ogg ./There is a hope so sure.mp3
command-mp3-2-ogg ./Oh I was made for this.mp3
command-mp3-2-ogg ./Blessed are the humble.mp3
command-mp3-2-ogg ./Earth Lies Spellbound.mp3
<snip>

The first command is 'IFS="' followed by a return, followed by '"'
(without the single quotes). This tells bash that only newlines should
be treated as delimiting "words" (filenames).

Having said that, IFS="" also works. See also
http://www.faqs.org/docs/bashman/bashref_33.html

I suppose it's now obvious for whom my machine is named... See
http://www.grahamkendrick.co.uk/ for information and links to some of
his music.

James.

-- 
E-mail address: james | "If you make everything a life and death proposition
@westexe.demon.co.uk  | you're going to have problems.  For one thing, you'll
                      | be dead a lot."


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