Say I want to schedule this job to be run at later time

MYPROGRAM > output.out 2> error.err | at 02:00 PM Mon

How can I attain its PID? Surely using:

echo $!

will not work?

  • Can you elaborate a little? You can't get the pid until the program runs, is MYPROGRAM trying to get its own pid for some purpose? (And is it a shell script, otherwise, $! won't mean anything to it?) Jan 23, 2016 at 17:53

1 Answer 1


You can't get a PID of a process which is not currently running, so there is no meaning for PID of a scheduled job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .