Re: [SLE] bash Script Using Filenames with Embedded Spaces




...

raven@static24-89-67-198:~> cat thingy
cd /pub/music/mp3
for i in *.m3u; do echo $i; done
cd ~

Do something other than echo in the loopl. Try applying sum, or ls, e.g.
You'll find unless you quote $i it won't work.

Randall Schulz

OK, here is my complete scipt which runs under bash on an Ubuntu 6.06
system where I have the mp32ogg utility to convert mp3 to ogg files which
k3b can handle:

for i in *.mp3
do
echo $i
mp32ogg $i
done

whch works fine if the only craziness is embedded spaces in the file name;
it failed when there were parentheses but, since that is rare in my
situation, I can live with it. (Of course, if the single quoted $i would
work there ... I'm off to try it!)

Thank you,
Lucky

--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-faq@xxxxxxxx



Relevant Pages