Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Continue with script while executing a line 2

Status
Not open for further replies.

pavNell

Technical User
Sep 27, 2002
178
US
Scripting noob here. Probably a real easy answer to this...

my script does something like....

...
while loop
do
some stuffA
some stuffB

cp my.file.xx /home/bill/stuff/file.xx

some stuffC
some stuffD
done
...

Lines in my script are executed one line at a time right? Is it possible to execute
the cp command above (copying a big file) and continue with the script without the script
waiting for the cp command to finish??

Thanks for any help.
 
cp my.file.xx /home/bill/stuff/file.xx [!]&[/!]

You may consider the wait command later in the script.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ahhh, backgrounding. Yes. I see the light now. Thanks.

For the wait command, I read up on wait and it's a little bit over my head. Is it so that the script doesn't kill the copying process (child) if the script (parent) dies for whatever reason??

Perhaps a simple wait example for this??

thanks.
 
stuffA
stuffB
copy $A $E &
stuffC
stuffD
wait # wait for copy process to finish before moving on
stuffE
stuffF

stuffC and stuffD can run in parallell to the copy process
stuffE and stuffF depend on the copy being finished, hence the wait before stuffE.

HTH,

p5wizard
 
That's great!! I understand now.
Thanks to both PHV and p5wizard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top