[ale] Embarassing script question

David S. Jackson dsj at sylvester.dsj.net
Fri Aug 8 00:59:51 EDT 2003


On Wed, Aug 06, 2003 at 09:28:44AM -0400 Geoffrey The Esoteric <esoteric at 3times25.net> wrote:
> for fn in *;do
> 	bmptoppm "$fn" | ppmtojpeg > "${fn%.bmp}.jpg"
> done
> 
> The ${fn%.bmp}.jpg will replace the trailing '.bmp' with '.jpg'
> 
> The double quotes around the to will stop the shell from interpreting 
> the special characters (space, &)
> 
> Another possibility which is a bit easier would be to use 'convert' 
> which is part of the ImageMagick package.  replace your 'bmptoppm.....' 
> line with the following:
> 
> convert "$fn" "${fn%.bmp}.jpg"
> 
> Have fun...

Matt, 

I think you'll find this in the Bash manpage under "parameter
expansion".

-- 
David S. Jackson                        dsj at dsj.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
My friend has a baby.  I'm writing down all the noises
he makes so later I can ask him what he meant.
		-- Steven Wright
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list