#!/bin/bash ## This is a shell for running pdflatex and bibtex on TeX files. ## Written Apr 29, 2010 ## Taha Ahmed ##### ## Supply the filename argument without file extension! if [ $# -gt 2 ]; then # More than two arguments echo More than two arguments. Too many! exit else # Two or less arguments if [ $# -eq 2 ]; then # Exactly two arguments # First argument should be jobname jobname=$1 # Test second argument if [ $2 == "-bib" ]; then BibliographyRequired=1 fi if [ $2 == "-biber" ]; then BiberRequired=1 fi else if [ $# -eq 1 ]; then # Only one argument # Argument specifies the jobname jobname=$1 # Set BibliographyRequired to false BibliographyRequired=0 else # No arguments submitted # No use right now echo No arguments submitted. exit fi fi fi pdflatex $jobname if [ $BibliographyRequired ]; then bibtex $jobname fi if [ $BiberRequired ]; then biber $jobname fi pdflatex $jobname pdflatex $jobname