[Gllug] batch convert

Tethys tet at accucard.com
Thu Jan 30 07:40:17 UTC 2003


Jonathan Harker writes:

>If I had these two files:
>
>ABBA - Money Money Money.mp3
>Shostakovich - Symphony No. 11, II. Allegro.mp3
>
>and a loop:
>
>for f in $files; do ... done
>
>then $f would be:
>
>ABBA
>-
>Money
>Money
>
> [...]
>
>This is bad. I've tried fiddling with "", escaping with \, to no avail.
>I gave up in the end and did it by hand.

Fiddling with quoting and escaping is a waste of time here, because your
input data is already broken -- the contents of $files has already lost
the line break information, and no amount of quoting will get it back
for you...

>Tet's trick of putting them in a file and going head -1 would work though. 

Yes, but like I said, it's somewhat of a hack. Is there a reason you need
the filenames in a variable in advance? Could you not just do:

	for f in *.mp3

or if you want to pass a list of files on the command line:

	for f in "$@"

Tet

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list