output nohup file containg the PID

Hi to everybody.

Is it possible to nohup a process and redirect the output to a file containing the PID?

E.g. if

nohup filename > out.nohup

associate the PID=8074 to filename, is it possible to call the output file something like out_8074.nohup instead of out.nohup? By this way it would be easy to kill the running process.

I tried the following and seems to work, but I don't know why:

nohup filename > out\_`expr $$ + 10`&

Can anyone explain me why or post a better solution?