Date: Sun, 9 Nov 2008 07:25:49 +0100 From: Polytropon <freebsd@edvax.de> To: Jonathan McKeown <jonathan+freebsd-questions@hst.org.za> Cc: freebsd-questions@freebsd.org Subject: Re: eps to jpg conversion - which program? Message-ID: <20081109072549.7272df20.freebsd@edvax.de> In-Reply-To: <200811081212.46286.jonathan%2Bfreebsd-questions@hst.org.za> References: <49143663.9070804@shopzeus.com> <20081107201954.5d7e4993.freebsd@edvax.de> <200811081212.46286.jonathan%2Bfreebsd-questions@hst.org.za>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 8 Nov 2008 12:12:46 +0200, Jonathan McKeown <jonathan+freebsd-questions@hst.org.za> wrote: > 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). Yes, that's a very good hint, I will use this in the future. Note that $f as first parameter is missing (source for convert). > As far as I can tell csh/tcsh doesn't support this > useful feature. Well, I prefer the C Shell (instead of BASH) as primary dialog shell, but for scripting, I always stay with the "good old" Bourne Shell, simply because it's the standard scripting shell for UNIX, and it's compatible to most Linusi, too (where /bin/sh@ -> /bin/bash, but NB ! -f /bin/bash in FreeBSD). > Essentially, a Bourne-type shell with parameter expansion expands > ${variable#prefix} or ${variable%suffix} to $variable with the prefix or > suffix, respectively, removed. So this would be more efficient: #!/bin/sh for f in *eps; do [ ! -f ${f%.eps}.jpg ] && convert $f ${f%.eps}.jpg done -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081109072549.7272df20.freebsd>