Well, two things:
First, you can't get the process id of a process that's complete, as it goes away.
Second, ps is a command that given the right flags returns more than just a single number - it returns a lot of data. You have to parse it to get the specific numbers you want.
Try running "ps" from your command line, and depending on your flavor of unix, "ps -ef" or "ps -aux" for more output.