Get process's time value

Hi, I'm trying to learn csh so I've started to do some simple scrips.
Now I'm kinda stuck in this one: I want to do a script that first search, for each user, if there's at least a process with a TIME >= something (30 mins, for example).
There are 2 things that I cant figure out:

  • in the "foreach" line, how can I specify the values that the PIDs can assume? Does
foreach pid ($PID)

work at all ?

  • How can I get the time value from each process?
    Thank you for your help

ps command will help u in what u trying to do..
like this

ps -ef 

it gives u the output with date and time.
if now u want all the process with in last somtime.

ps -ef > file

then u can use loop on file easily and inside loop can use find command for mtime.

or u can use pipe and use awk and print $5, $6 and $8 and u will have time and then u can see which 1 is bigger.

Hi GarFunkel, are you learning csh because of a legacy situation? Otherwise I would advise you learn a bourne shell derivative instead, e.g. ksh.
Here are two links that discuss the problems with csh :

C shell - Wikipedia, the free encyclopedia
Csh Programming Considered Harmful

Thank you dazdseg for the help. Since I'm trying to learn the shell mechanisms I'm gonna try both right now.

Actually I'm reading some handouts that use mainly the Bourne and the C shell, that's the only reason :rolleyes: