[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Sat, Jun 21, 2003 at 01:11:14AM -0500, Harold Crouch wrote:
> I tried piping the two commands...
>   tiff2ps -a MSDS7009.TIF  |  ps2pdf
> ...but it didn't work.  I assume that it failed because ps2pdf didn't
> have an input filename and therefore couldn't generate an output
> filename.  I don't see any way to specify an output filename for
> ps2pdf without preceeding it with an input filename, so it looks like
> piping the two commands doesn't simplify anything.  But this is no big
> deal.


set -e # Stop on errors.
set -C # noclobber

for file in *.TIF ; do
    ps="`echo $file | sed 's/TIF$/ps/'`"
    tiff2ps -a "$file" > "$ps"
    ps2pdf "$ps"

> If I were a programmer (which I'm not) I think that I would want to
> create a loop of some type that... 
>  1.  started with n=7000, 
>  2.  incremented by 1, 
>  3.  checked to see if the input file existed,
>  4.  converted the input file if it *did* exist, or
>  5.  jumped to the top if the input file did *not* exist, and
>  6.  stopped at n=7201. 

If you want to get that specific...  (The above should work though,
I'd think.)


set -e
set -C

while [ $n -lt 7202 ] ; do
    if [ -f MSDS$n.TIF ] ; then
        ps="`echo $file | sed 's/TIF$/ps/'`"
        tiff2ps -a "$file" > "$ps"
        ps2pdf "$ps"
    (( n++ ))

steve@silug.org           | Southern Illinois Linux Users Group
(618)398-7360             | See web site for meeting details.
Steven Pritchard          | http://www.silug.org/

To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.