From owner-freebsd-questions@FreeBSD.ORG Tue Jun 19 01:30:17 2012 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 0AD47106566B for ; Tue, 19 Jun 2012 01:30:17 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id BBFA98FC08 for ; Tue, 19 Jun 2012 01:30:16 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q5J1UQ1C015381; Mon, 18 Jun 2012 20:30:26 -0500 (CDT) Date: Mon, 18 Jun 2012 20:30:26 -0500 (CDT) From: Robert Bonomi Message-Id: <201206190130.q5J1UQ1C015381@mail.r-bonomi.com> To: freebsd-questions@freebsd.org, olivares14031@gmail.com In-Reply-To: <201206190110.q5J1AorD015312@mail.r-bonomi.com> Cc: Subject: Re: converting mpost(ed) files individually to eps X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 01:30:17 -0000 > > Date: Mon, 18 Jun 2012 19:50:01 -0500 > > From: Antonio Olivares > > 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=$file.eps $file.1 > end I may have understood. if it is MPOST that is producing the multiple files, then you want: $MPOST for file in file.* do $GS -dNOPAUSE -dBATCH -sDEVICE=epswrite -sOutputFile=$file.eps $file end This will produce a series of files named file.1.eps, file.2.eps, etc.