eps to jpg conversion - which program?

Jonathan McKeown jonathan+freebsd-questions at hst.org.za
Sat Nov 8 02:56:36 PST 2008

On Friday 07 November 2008 21:19, Polytropon wrote:
> On Fri, 07 Nov 2008 13:36:51 +0100, Laszlo Nagy <gandalf at shopzeus.com> 

> A batch solution is simple:
> 	#!/bin/sh
> 	for f in *eps; do
> 		convert ${f} `basename ${f} .eps`.jpg
> 	done

You can also save yourself repeated calls to basename by using

for f in *eps; do
    convert ${f%.eps}.jpg

Look under parameter expansion in the manpage for sh(1) (or bash(1) if you 
have bash installed). As far as I can tell csh/tcsh doesn't support this 
useful feature.

Essentially, a Bourne-type shell with parameter expansion expands 
${variable#prefix} or ${variable%suffix} to $variable with the prefix or 
suffix, respectively, removed.


More information about the freebsd-questions mailing list