On Sat, 8 Nov 2008 12:12:46 +0200, Jonathan McKeown <[EMAIL PROTECTED]> 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, ...
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to