[OT] remove process or file [was Re: [plug] funny process name]

Ben New ben at leftclick.com.au
Tue Sep 30 14:03:48 WST 2003


Bernd Felsche wrote:

>I'm still waiting for
>	rm proc/somenumber
>to remove a process.
>  
>
# mv /bin/rm /bin/rm.orig
# vi /bin/rm
for p in ${@#/proc/} ; do
if [ -e /proc/$p ] ; then kill -KILL $p ; fi
done
/bin/rm.orig $@
:w
:q
# chmod +x /bin/rm


Not bulletproof! (I just whipped it up then) but it will work for "rm 
1234" or "rm /proc/1234"
;-)

I'm sure there's a better way to test for a process with given ID ($p) 
other than testing for a file in /proc, but not sure how?

-- 
Ben New
ben at leftclick.com.au
0407 089 890

Leftclick Software Development
http://www.leftclick.com.au/
08 9433 5380


_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list