Unix Shell - wav2mp3; bmp2jpg

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > January 2006 > wav2mp3; bmp2jpg





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author wav2mp3; bmp2jpg
TOC

2006-01-29, 9:31 pm

you media experts care to give me feedback on the following one-liners?





for X in $(find -type f -name "*.bmp"); do convert -quality 100 "$X"
"${X%%.bmp}.jpg"; done
for X in $(find -type f -name "*.wav"); do lame -q0 "$X" "${X%%.wav}.mp3";
done
Chris F.A. Johnson

2006-01-29, 9:31 pm

On 2006-01-28, TOC wrote:
> you media experts care to give me feedback on the following one-liners?


They are not one-liners; they are 3- or 4-line scripts squished
onto a single line and mangled by your news posting software.

> for X in $(find -type f -name "*.bmp"); do convert -quality 100 "$X"
> "${X%%.bmp}.jpg"; done


If you had formatted the script sensibly, the lines wouldn't have
been broken:

for X in $(find -type f -name "*.bmp")
do
convert -quality 100 "$X" "${X%%.bmp}.jpg"
done

> for X in $(find -type f -name "*.wav"); do lame -q0 "$X" "${X%%.wav}.mp3";
> done


These will break if there are spaces in the filenames.

The double percent sign is not necessary; you only need one:

.... "${X%.wav}.mp3"

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
TOC

2006-01-29, 9:31 pm

"Chris F.A. Johnson" <cfajohnson@gmail.com> wrote in
news:i0osa3-2bm.ln1@teksavvy.com:

> On 2006-01-28, TOC wrote:
>
> They are not one-liners; they are 3- or 4-line scripts squished
> onto a single line and mangled by your news posting software.
>
>
> If you had formatted the script sensibly, the lines wouldn't have
> been broken:
>
> for X in $(find -type f -name "*.bmp")
> do
> convert -quality 100 "$X" "${X%%.bmp}.jpg"
> done
>
>
> These will break if there are spaces in the filenames.
>
> The double percent sign is not necessary; you only need one:
>
> ... "${X%.wav}.mp3"
>



ok, well here is a one-liner:
eat my balls

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com