mikshaw
Group: Members
Posts: 4856
Joined: July 2004 |
|
Posted: May 22 2006,14:57 |
|
Quote (lesliek @ May 22 2006,01:28) | Does "pidof xmms" get xmms's pid(s) without backgrounding xmms?
I opened xmms by clicking on its icon on the desktop. I then opened a terminal, typed pidof xmms and pressed Enter and got as output: 1189 1190 1191 1192.
Of course, I may not be understanding what backgrounding is. |
Backgrounding is necessary from a script if you need to continue on to do something else while the previous command is still running. In this case, xmms must be put into the background (xmms &) so that the next command (pidof xmms) can run. Otherwise pidof will not run until xmms is closed, and then it's too late to get its pid. You successfully got the pid when you did it manually because you opened a new shell while xmms was running, but you can't do that from a script unless you background xmms. As I said before, xmms isn't the most appropriate tool with which to do a batch process, since it requires interaction with the user (unless you add more software as jot suggested).
jot: submit mydsl extensions to extensions(at)damnsmalllinux(dot)org
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|