Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use GUI editors for $VISUAL editing' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use GUI editors for $VISUAL editing
Authored by: gshenaut on Feb 13, '05 08:31:57PM
I'm concerned about the wait loop using ps(1). First, I think you might want not to include the flags -a and -u, because -a includes commands being run by all users, and you probably just want your commands, and because the extra text produced by -u doesn't seem relevant to this task. Second, use of ps and grep seems like overkill. You could use something like this to get the pid of the process
ps xc | grep "Program Name" | head -1 | read thePid junque
and then in your loop, use
while kill -0 $thePid 2>/dev/null ; do
...
This would seem to be less resource intensive. Or, a simple loop using
while killall -0 "Program Name" 2>/dev/null ; do
...
would be an improvement, but killall(1) uses more resources than kill(1). Just a thought. It's too bad there isn't a way to make GUI programs synchronous.

Greg Shenaut

[ Reply to This | # ]