From: Gennady Bystritsky Date: 2009-12-15T08:47:06+09:00 Subject: Re: [OT] bash "wait for previous to finish" option? On Dec 14, 2009, at 2:57 PM, Roger Pack wrote: > Anybody know if something like this exists. > > two terminals open > > 1) hack hack hack [start long running process] > 2) hack hack [type in the name of a command which should be run > immediately after long running process in terminal one finishes--and > somehow it will start immediately afterward]. > > [windows compatible would be nice]. > > Anything like that out there? $ date; sleep 60 & Mon Dec 14 15:37:56 PST 2009 [1] 32459 $ while kill -0 32459; do sleep 1; done; date; echo DONE ksh: kill: 32459: No such process Mon Dec 14 15:38:57 PST 2009 DONE [1] + Done sleep 60 $ "sleep 60 &" emulates your long running process, no matter from what terminal as long as you can find out its process id. "echo DONE" will be executed right after process 32459 (sleep 60) terminates. If you do not want to see the error from kill, redirect its stderr to /dev/null (for the above, kill -0 32459 2>/dev/null). No windows, sorry. Gennady. > Thanks. > -r > -- > Posted via http://www.ruby-forum.com/. >