
Leslie Katz wrote:
I have an icon for xmms on my desktop. I click on the icon; xmms opens in its own little window. I open a terminal. I type in it kill -9 $(pidof xmms) and press Enter. The xmms window closes.
I have a bash script. A line in it runs xmms, at which point xmms's little window opens and converts a .wma file to a .wav file. The next line in the script says kill -9 $(pidof xmms), but it doesn't work to close the xmms window. That window stays open until I click on the close box in the top right of the window.
Why doesn't the kill command work in the second case when it works in the first?
At work, most of our test scripts are bash... We use, in some cases where it is safe too, "killall" (from the psmisc package): killall xmms But that has the affect of killing all (go figure ;) ) processes with that name. If that works, then sweet. If we want to only kill a specific instance of an application, we usually do: xmms & xmms_pid=$! . . . kill $xmms_pid This way works nice in most environments, "killall" isn't available for cygwin and "pidof" seems to be a debian thing (maybe RHEL too cant recall) but not for FreeBSD or cygwin. Michael