title: Using ps2pdf correctly in a script?
body: <p>I have a script below and I am having problems. I have several folders with PostScript file in them I want to batch convert to PDFs. I have done very little scripting in linux before but I think this is close. It is not quite working how I want it though. Any suggesting? or notice a mistake I made? I want the files to stay in the same location after they have been converted. Currently this converts the files but they get all put together in one folder.</p>
  
  <p>I call the script  like this: ./all.ps.to.pdf "/directory/to/process"</p>
  
  <pre><code>#!/bin/sh
  
  STARTDIR=$1
  if [ ! -d "$STARTDIR" ]; then
  echo No starting directory $STARTDIR
  exit 1
  fi
  
  find $STARTDIR -name '*.ps' -print | sed -e 's/.ps$//' |
  xargs -l -i  ps2pdf \{}.ps
  </code></pre>