From owner-freebsd-questions@FreeBSD.ORG Sun Nov 9 06:25:54 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 808091065672 for ; Sun, 9 Nov 2008 06:25:54 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 42CDD8FC0A for ; Sun, 9 Nov 2008 06:25:53 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r55.edvax.de (port-92-196-88-233.dynamic.qsc.de [92.196.88.233]) by mx01.qsc.de (Postfix) with ESMTP id ED5E55040F; Sun, 9 Nov 2008 07:25:51 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id mA96PnKY002703; Sun, 9 Nov 2008 07:25:50 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Sun, 9 Nov 2008 07:25:49 +0100 From: Polytropon To: Jonathan McKeown Message-Id: <20081109072549.7272df20.freebsd@edvax.de> In-Reply-To: <200811081212.46286.jonathan+freebsd-questions@hst.org.za> References: <49143663.9070804@shopzeus.com> <20081107201954.5d7e4993.freebsd@edvax.de> <200811081212.46286.jonathan+freebsd-questions@hst.org.za> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: eps to jpg conversion - which program? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Nov 2008 06:25:54 -0000 On Sat, 8 Nov 2008 12:12:46 +0200, Jonathan McKeown 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, ...