Jeff Abrahamson on Sun, 12 May 2002 12:50:11 +0200 |
On Sun, May 12, 2002 at 11:34:30AM +0200, Jeff Abrahamson wrote: > On Sat, May 11, 2002 at 01:43:50PM -0400, Nick Rongione wrote: > > Specifically, I want to kick off a delete of a huge directory and in > > the mean time interact with the user a bit more. Only when i know the > > delete is complete I want to continue doing the rest of the script > > actions. > > > > I don't know how to pull that off in bash. Any help would be appreciated. > > Fred proposed looping on a ps, which would surely work. > > You might also do something like the following: > > tmp=/tmp/foo.$$.`date +%Y%m%d%H%M%s` > rm -rf $dir $tmp & > do_stuff > while [ -r $tmp ]; do sleep 1; done > do_more_stuff > > The rm will remove the directory first, then move on to its second > argument. This may not be entirely portable, as some rm implementation > somewhere may just perversely unlink its arguments in reverse order. Sorry, the careful reader no doubt realized that I forgot to point out that you have to touch $tmp before rm'ing it. -- Jeff Jeff Abrahamson <http://www.purple.com/jeff/> The Big Book of Misunderstanding, now in bookstores and on the web: <http://www.misunderstanding.net/buystuff.html> Attachment:
pgpEa5BFIOkFE.pgp
|
|