The solution outlined below reguarding checking the pid is a good solution to the problem. Another idea, which is a complete kludge, is just to type ahead in the terminal.
Both solutions would work the same, but neither will know if the original command was sucessful or not. ~Mike -><- "And don't tell me there isn't one bit of difference between null and space, because that's exactly how much difference there is. :-)" --Larry Wall in <[EMAIL PROTECTED]> SDF Public Access UNIX System - http://sdf.lonestar.org On Wed, 18 Jun 2003, Ohad Lutzky wrote: > On Wed, Jun 18, 2003 at 01:15:11PM +0000, Christopher Egner wrote: > > You could use && or ||. > > && works only if the return is zero, usually meaning everything worked > > in the first program. The second, || only works if the return is non > > zero. > > You guys aren't getting it... the command is already running. He's > thinking along the lines of this: "Okay, I'm downloading this file, it's > not resumable and already at 60%. It'll take a few hours more to > download and quite a while to untar it. I'm going to sleep now... I wish > I could tell it to untar once it's done downloading. Too bad I can't > start over without losing all the progress it already made." > > As for the solution - I got nothing concrete, but here's my idea: Figure > out the PID of the process you want to be finished. Then create a script > that loops while the PID is existant, and once it's not - does whatever > it is that you want to do. Actually, that would be a one-liner. Here's > my idea: > > First, get the PID using pidof. I'll call it $THE_PID > Then what you need is this: > > $ while [ -e /proc/$THE_PID ]; do; sleep 5; done && echo "Process exited" > > Of course, you change the echo command to whatever you want. > There might be a better way to do this, I usually such at shell-fu, and > the only thing I know about /proc is that if a process is running, it's > PID is there. :) > > > > > , but I'm > not sure ho > > -- > Tactless > > "If it wasn't for fog, the world would run at a really crappy framerate." > This is a .signature virus! Please copy me into your .signature. > > -- > [EMAIL PROTECTED] mailing list > -- [EMAIL PROTECTED] mailing list