Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Getpid

Status
Not open for further replies.

crystal28

Programmer
Oct 23, 2002
108
US
Please can anyone give me the syntax in cshell how to get the value that returns from the function getpid,so that i can use it to kill a process
 
getpid is a C library function, not a command available to csh.

If you want to find PIDs from a shell script, use "ps".
 
Thank you.Sir i am new to shell scripts.Can u give me a example of how to get the pid into a variable.
will it be like

set v_pid=ps
 
In ksh , a shell veriable $$ contains the id of the current process .

So ,

kill $$

will kill the currecnt process , which generally does not look like a logical task .

If u want to kill some perticular process ,

ps -e -o "%p %y %a"

will give u only the process id , terminal name and process description . grep or with some logic select your processes to be killed and then use the id to kill processes .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top