Xref: utzoo comp.unix.questions:26911 comp.unix.shell:899 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!hsi!hsi86!mark From: mark@hsi86.hsi.com (Mark Sicignano) Newsgroups: comp.unix.questions,comp.unix.shell Subject: Re: exit value (MORE INFO) Message-ID: <2586@hsi86.hsi.com> Date: 15 Nov 90 03:00:05 GMT References: <1990Nov12.110248@cs.utwente.nl> <1990Nov13.160213.15743@ssd.kodak.com> <1990Nov14.100834@cs.utwente.nl> Reply-To: mark@hsi.com (Mark Sicignano) Followup-To: comp.unix.questions Organization: 3M Health Information Systems, Wallingford, CT. Lines: 36 In article <1990Nov14.100834@cs.utwente.nl> stadt@cs.utwente.nl (Richard van de Stadt) writes: ... > break ;; > *) # a new floppy > dkformat -m /vol/new_name >/dev/null 2>&1 & #no output on screen > sleep 10 # be sure process is started > # actually done by looping on pid > attent /dev/dk1 # give what dkformat is waiting for > wait # wait for format process to have finished > exitval='exit_value_of_last_process_started_in_background' ;; > esac ... read the man page on sh(1)... particularly the "wait" command. Wouldn't this work? dkformat -m /vol/new_name > /dev/null 2>&1 & sleep 10 attent /dev/dk1 wait $! exitval=$? wait will wait for a particular process id, if one is given, and will return the exit status of the process id. $! is the pid of the last command ran in the background. In other words, the wait will wait for your dkformat to exit and will return the status, which you can get from $?. You had all of the pieces to the puzzle yourself, just didn't put them together right. Have fun! -mark -- Mark Sicignano ...!uunet!hsi!mark 3M Health Information Systems mark@hsi.com