I would like to put several commands into a shell script.
How can i reach the following:

Split a pdf file into single pages.
convert resulting pdfs to postscript.
convert resulting pses into jpgs.

It would be nice to have all files in subdirectories.
If i do
CODE
sh splitandgo.sh directory/filename.pdf

it should result in /directory/ps/, /directory/jpg/ and /directory/pdf/

The commands i tend to use are
CODE
pdftk filename.pdf burst output ./page%03d.pdf
pdftops page_0001.pdf
gs -dBATCH -dNOPAUSE -sDEVICE=jpeg -sOutputFile=filename_00.jpg -r100 filename_00.ps


Edit: I solved it!
CODE
#!/bin/sh
# A script to convert pdf to single pages pdf, ps and jpg
#
# pdftk, xpdf and ghostscript needed
###########################################################
# edit this if you like
WIDTH=200;
HEIGHT=160;
RES=100;
PREFIX=page;
PDFDIR=pdf;
PSDIR=ps;
JPGDIR=jpg;
#
###########################################################
mkdir $PDFDIR;
mkdir $PSDIR;
mkdir $JPGDIR;
pdftk $1 burst output ./$PDFDIR/$PREFIX%03d.pdf;
cd $PDFDIR;
FILES=$(ls -l | wc -l);
echo $FILES" files found";
cd ..;
COUNTER=1;
while [  $COUNTER -lt $FILES ]; do
  if test $COUNTER -ge 100
             then CURRENTPAGE=$COUNTER
             elif test $COUNTER -ge 10
               then CURRENTPAGE=0$COUNTER
             else CURRENTPAGE=00$COUNTER
           fi
           pdftops -paperw $WIDTH -paperh $HEIGHT $PDFDIR/$PREFIX$CURRENTPAGE.pdf $PSDIR/$PREFIX$CURRENTPAGE.ps;
           gs -dBATCH -dNOPAUSE -sDEVICE=jpeg -sOutputFile=$JPGDIR/$PREFIX$CURRENTPAGE.jpg -r$RES $PSDIR/$PREFIX$CURRENTPAGE.ps;
           let COUNTER=COUNTER+1;
         done;