wait command

Hi all,
I have never used the wait command before and want to know how it works.

I basically need to run four sqlplus sessions in parallel as background processes and i am spooling the results obtained from the database into files.I need to wait for all the processes to finish and then make sure all the files are generated and perform a merge thereafter.

Thanks
Vinay

THis may help you....

[

](http://</p><p><a href="make my script wait" target="_blank">http://www.unix.com/shell-programming-scripting/12769-make-my-script-wait.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;)

Thanks
SHa

Embed the sqlplus behind a & then wait - stupid example:

 echo "
spool a.lis
select * from table1;
exit
" | sqlplus -s user/pass@dbname 2>&1 >/dev/null &

 echo "
spool b.lis
select * from table2;
exit
" | sqlplus -s user/pass@dbname 2>&1 >/dev/null &

wait 

In order to prevent SIGTTOU signals, you have redirect stder and stdout to /dev/null or you can nohup the command