#!/bin/bash files=`ls ../Data/whichData/*.data`; i="new"; for file in $files do stem=`basename $file .data`; self=plotData/self/gnus$stem.pdf; disc=plotData/nbins/gnu$stem.pdf; all="all.pdf"; if [ $i = "new" ]; then echo "First combine." i="old"; gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$all $self $disc; else echo "Combining $self with $all." gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=temp $all $self; echo "Combining $disc with $all." gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$all temp $disc; fi done #gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$all self disc;