> Date: Mon, 28 Sep 1998 14:55:21 +0200 (MSZ)
> From: Stefan Evert <[EMAIL PROTECTED]>

> If download time doesn't matter, you'll find a good example for such a
> shell script in the Unix port of PMX available from the GMD music archive 
> (I can't remember the precise path, but Werner Icking will be able to
> provide that).

http://www.gmd.de/Misc/Music/  look for MusiXTeX, PMX, Unix/C-version

> That package contains a shell script named 'pmx' which [...]

[... Long signature replaced by script :-]

#!/bin/sh
#
# Script to run pmxa, pmxb and all 3 passes of MusiXTeX
# (courtesy of Jan Arne Fagertun, modified by Stefan Evert)
#
# Tue Feb 18 18:12:15 MET 1997 [EMAIL PROTECTED]
# last modified:
# Mon Jul 21 13:05:46 MET DST 1997 [EMAIL PROTECTED]
#
if [ "$1" != "" ]
then
  FILE=$1
  if [ ! -f $FILE ]
  then
    FILE=$1".pmx"
  fi
  if [ -f $FILE ]
  then
    BASE=`basename $FILE .pmx`
    TEX=$BASE".tex"
    #
    # Cleaning up in case of crash
    #
    if [ -f $TEX ]
    then
      echo "Deleting $TEX"
      rm -f $TEX
    fi
    LOG=$BASE".log"
    if [ -f $LOG ]
    then
      echo "Deleting $LOG"
      rm -f $LOG
    fi
    MX1=$BASE".mx1"
    if [ -f $MX1 ]
    then
      echo "Deleting $MX1"
      rm -f $MX1
    fi
    MX2=$BASE".mx2"
    if [ -f $MX2 ]
    then
      echo "Deleting $MX2"
      rm -f $MX2
    fi
    if [ -f pmxtex.dat ]
    then
      echo "Deleting pmxtex.dat"
      rm -f pmxtex.dat
    fi
    if [ -f pmxtex.fig ]
    then
      echo "Deleting pmxtex.fig"
      rm -f pmxtex.fig
    fi
    #
    # Start of pmx - pmxa
    #
    echo "=== RUNNING PMXA (1st pass) ==="
    (echo $BASE | pmxa) || exit 1
    #
    # Check if successful
    #
    if [ ! -f pmxtex.dat ]
    then
      exit 1
    fi
    if [ ! -f pmxtex.fig ]
    then
      exit 1
    fi
    #
    # pmxb
    #
    echo "=== RUNNING PMXB (2nd pass) ==="
    pmxb || exit 1
    #
    # check for success
    #
    if [ ! -f $TEX ] 
    then
      exit 1
    fi
    #
    # Cleaning up after pmx
    #
    echo "Cleaning up (pmxtex.dat pmxtex.fig)"
    rm -f pmxtex.dat
    rm -f pmxtex.fig
    #
    # Start MusiXTeX - tex
    #
    echo "=== RUNNING MUSIXTEX: 1st pass (tex) ==="
    tex $BASE || exit 1
    if [ ! -f $MX1 ]
    then
      exit 1
    fi
    #
    # Discard .dvi created by first pass
    #
    DVI=$BASE".dvi"
    if [ -f $DVI ]
    then
      echo "Discarding $DVI"
      rm -f $DVI
    fi
    #
    # musixflx
    #
    echo "=== RUNNING MUSIXTEX: 2nd pass (musixflx) ==="
    musixflx $BASE || exit 1
    if [ ! -f $MX2 ]
    then
      exit 1
    fi
    #
    # tex again
    #
    echo "=== RUNNING MUSIXTEX: 3rd pass (tex) ==="
    tex $BASE || exit 1
    #
    # Check if we're successful
    #
    if [ ! -f $DVI ]
    then
      echo "*** PMX failed"
      exit 1
    fi
    #
    # Cleaning up after MusiXTeX
    #
    if [ -f $MX1 ]
    then
      echo "Deleting $MX1"
      rm $MX1
    fi
    if [ -f $MX2 ]
    then
      echo "Deleting $MX2"
      rm $MX2
    fi
    echo "Done."
  else
    echo "Can't find either "$1" or "$FILE
  fi
else
  echo "PMX-1.3.8: Convert .pmx input file into .dvi"
  echo "Usage:  pmx <pmx_input_file>"
fi

Reply via email to