Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jun 2012 20:10:50 -0500 (CDT)
From:      Robert Bonomi <bonomi@mail.r-bonomi.com>
To:        freebsd-questions@freebsd.org, olivares14031@gmail.com
Subject:   Re: converting mpost(ed) files individually to eps
Message-ID:  <201206190110.q5J1AorD015312@mail.r-bonomi.com>
In-Reply-To: <CAJ5UdcNTo5mhjtadHy_bMume=Gvpnp%2B7rkTUJoiCmLt6a8DLyA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> From owner-freebsd-questions@freebsd.org  Mon Jun 18 19:50:45 2012
> Date: Mon, 18 Jun 2012 19:50:01 -0500
> From: Antonio Olivares <olivares14031@gmail.com>
> To: FreeBSD Questions <freebsd-questions@freebsd.org>
> Subject: converting mpost(ed) files individually to eps
>
> Dear folks,
>
> I am taking a plunge to learning a little bit of metapost.  I have
> found examples page using google.
>
> http://www.tlhiv.org/MetaPost/examples/examples.html
>
> I want to convert output files individually to eps.
>
> I can only convert the first one output say file.1 to file.eps, but
> when there are more files, ie, file.2, ..., file.10, all the files
> between .2 and .10 do not get converted/saved to *.eps extension.

Correct.  The script you showd processes a _single_ argument only.
Use a 'for loop' to handle multiple files, something like  --
   for thisfile in file.* do
    `mpost-eps $thisfile
   end

>
> [[ sneck -- copy of script itself ]]
>
> I run the script
> $ ./mpost-eps file
> without *.mp extension.  but only one gets converted.  I don't know
> enough shell programming to do something like
> for i in file.i do
> $GS -dNOPAUSE -dBATCH -sDEVICE=epswrite -sOutputFile=$1.eps $1.i

You were *close*.  what you wanted is (assuming MPOST and GS are defined:
  for file in {{list or wildcard}} do
   $MPOST $file
   $GS -dNOPAUSE -dBATCH -sDEVICE=epswrite -sOutputFile=$ile.eps $file.1
  end



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206190110.q5J1AorD015312>