Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Nov 2008 12:12:46 +0200
From:      Jonathan McKeown <jonathan+freebsd-questions@hst.org.za>
To:        freebsd-questions@freebsd.org
Subject:   Re: eps to jpg conversion - which program?
Message-ID:  <200811081212.46286.jonathan%2Bfreebsd-questions@hst.org.za>
In-Reply-To: <20081107201954.5d7e4993.freebsd@edvax.de>
References:  <49143663.9070804@shopzeus.com> <20081107201954.5d7e4993.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 07 November 2008 21:19, Polytropon wrote:
> On Fri, 07 Nov 2008 13:36:51 +0100, Laszlo Nagy <gandalf@shopzeus.com> 
wrote:

> 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
done

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.

Jonathan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811081212.46286.jonathan%2Bfreebsd-questions>