Sometime Today, USM Bish assembled some asciibets to say:

> Yep, killall is the built-in method for all systems. Always
> there ...

except that it tries to kill all processes with that name.  If you're
running as non-root (as mentioned in your LOST), then it's more or less
safe.

Let's think about some way to kill just a single instance of the
process.  How about something like this:

for i in $( ps -ae | sed -e '/process-name/{s/^ *//;p;}' ); do
        echo -n "Kill process: $i? [y/N] "
        read kill_yn
        case $kill_yn in
                [yY]) kill $( echo $i | cut -f1 -d" " )
                        ;;
        esac
done

definitely much slower, but it expects user input, so hey, no
difference.

If you put this in a shellscript, then you could pass the process name
and an optional signal to send instead of -KILL

$1 is the signal if specified (starts with -) or the processname.  $2 is
the processname if no signal.

-- 
Use recursive procedures for recursively-defined data structures.
            - The Elements of Programming Style (Kernighan & Plaugher)


_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to