Make sure that $pid is a numeric value only do ------------ echo" ==$pid == " ----------------- and check where it is comming on the same line my system it was working fine .
-----------o/p------------------ [sachinr@localhost docs]$ vim
[1]+ Stopped vim [sachinr@localhost docs]$ ps -ad |grep vim 11777 pts/51 00:00:00 vim [sachinr@localhost docs]$ export pid=11777 [sachinr@localhost docs]$ kill -9 $pid [sachinr@localhost docs]$ [1]+ Killed vim [sachinr@localhost docs]$