Tag Archives: pkill

pkill script for cygwin

pkill is a basic necessity of life. For cygwin, this comes in the package procps which is not available for x64. You can of course ps and grep then awk but who has the time.

This small script from cygwin mailing list archives to the rescue:

#!/bin/sh
# pkill
# be VERY careful with parameter $1
case $1 in
'' )
cat "$0"
;;
* )
for pid in $( ps -aW | grep -i $1 | awk '{ print $4 }' );
do tskill $pid /V;
done
;;
esac
view raw pkill hosted with ❤ by GitHub

tskill is actually a kill equivalent in the Windows world.