![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Kill a process without using kill command | sudhamacs | Linux | 6 | 10-27-2008 12:36 PM |
| Kill a process without using kill command | sudhamacs | Shell Programming and Scripting | 0 | 10-01-2008 06:19 PM |
| Diff b/n kill and kill -9 | ammu | UNIX for Advanced & Expert Users | 2 | 07-18-2007 06:29 PM |
| not able to kill find with kill -9 | Amardeep | UNIX for Dummies Questions & Answers | 5 | 01-04-2007 05:49 PM |
| When kill doesnt work, how to kill a process ? | VijayHegde | UNIX for Advanced & Expert Users | 3 | 05-12-2006 05:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
kill itself
Hey I need to write a script that can kill itself. I have to use the command kill within it.
So I have gotten my head around to that I need to use ps to get the PID but I have no idea how to store that PID in a variable to be able to then kill the script. So is there a way to grab the PID within the script so that I can kill it? |
|
||||
|
Surely "exit" is easier.
The PID of the current shell is $$ e.g. PID=$$ echo "${PID}" Be careful. It is rarely necessary to kill processes which are under control. Last edited by methyl; 03-30-2009 at 08:09 PM.. Reason: Clarify |
|
||||
|
Except I have to use the kill command. One of those pesky requirements.
EDIT: Sorry I didn't see your explanation at first. Thanks a bunch that was giving me a somewhat hard time. I'm fairly new to unix in general and really do not spend that much time with it. Last edited by mauler123; 03-31-2009 at 12:22 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|