differentiating PIDs under 200

Hey,

So I'm new to shell scripting, and I'm trying to write one for my lab that will keep down the work load by deleting processes that are left over from previous sessions.

Basically I want it to do three things.

1) Check the processes running
2) See if that person is logged on.
3) if not, delete the process.

I've got a pretty good idea about how to do all that, but I need it to ignore all of the root and system processes that run all the time. All of those have a PID under 200 so how do I say

"For processes with PID over 200" or possibly "Show only processes with PID over 200"? I could also do between 200-10000.

I tried 'seq 200 10000', but I think it's too big of a range, and it won't work.

then the next step I'm using is

ps auxw |cut -f1 -d\ |sort -u > $OUTPUTLOC/ScriptDraft.proc$$

(where OUTPUTLOC = /tmp)

Any help is greatly appreciated.

Looking for process based on pid ranges is not a good idea. What I suggest is to identify the processes based on its name/script name.

However for the question you asked, here is the answer

ps -ef | awk '$2 >200 && $2<10000'

I might suggest that you approach this differently.

If the user is logged out, there will be no tty listed in ps - it will be a question mark.

Secondly - hanging processes like this are almost always some badly written app - don't you already know what the process name is??

Another often useful clue for these things is that they sometimes accumulate much more CPU time than would be normal (again, badly written to start with and they go insane when disconnected from their pty).