#!/usr/local/bin/bash
# 
# laps: Runs LaTeX, then converts output to Postscript
# 
# April 15, 2001, Andrew D. Hwang, ahwang@mathcs.holycross.edu
#

filename=$1
fileroot=${filename%%".tex"} # Strip .tex from filename

if [ $# != 1 ] 
  then  
    echo "Usage: laps <filename>" 
    echo
    exit 1

  elif [ ! -f $1.tex ] && [ ! -f $fileroot.tex   ]
    then
      echo "File $fileroot.tex not found, exiting" 
      echo
      exit 2
fi

latex $fileroot.tex ; dvips -f $fileroot.dvi > $fileroot.ps

exit 0
