<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Easy shell script (korn) question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558296#M725005</link>
    <description>I am writing a shell script and in the middle of it I have two commands that I want to run at the same time.  I dont want the scipt to continue until BOTH comamnds have completed.&lt;BR /&gt;&lt;BR /&gt;I know I can put an &amp;amp; at the end of the first command so the second one kicks off right away and runs at the same time, but how do I make the shell script wait for the next command if the second one finishes first?&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
    <pubDate>Sun, 29 Jul 2001 07:30:10 GMT</pubDate>
    <dc:creator>Jeanine Kone</dc:creator>
    <dc:date>2001-07-29T07:30:10Z</dc:date>
    <item>
      <title>Easy shell script (korn) question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558296#M725005</link>
      <description>I am writing a shell script and in the middle of it I have two commands that I want to run at the same time.  I dont want the scipt to continue until BOTH comamnds have completed.&lt;BR /&gt;&lt;BR /&gt;I know I can put an &amp;amp; at the end of the first command so the second one kicks off right away and runs at the same time, but how do I make the shell script wait for the next command if the second one finishes first?&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Sun, 29 Jul 2001 07:30:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558296#M725005</guid>
      <dc:creator>Jeanine Kone</dc:creator>
      <dc:date>2001-07-29T07:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Easy shell script (korn) question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558297#M725006</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Use wait command. wait command will wait untill the previous background command finishes. See the man page for more info.&lt;BR /&gt;&lt;BR /&gt;Reg,&lt;BR /&gt;&lt;BR /&gt;Paulson</description>
      <pubDate>Sun, 29 Jul 2001 09:21:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558297#M725006</guid>
      <dc:creator>vtpaulson</dc:creator>
      <dc:date>2001-07-29T09:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Easy shell script (korn) question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558298#M725007</link>
      <description>Hi Jeanine:&lt;BR /&gt;&lt;BR /&gt;Consider this:&lt;BR /&gt;&lt;BR /&gt;./mytask1 &amp;amp;&lt;BR /&gt;T1=$! #...capture the pid of mytask1...&lt;BR /&gt;./mytask2&lt;BR /&gt;if [ $? -eq 0 ]; then&lt;BR /&gt;  echo "task2 completedok"&lt;BR /&gt;fi&lt;BR /&gt;wait T1 #...wait for mytask1...&lt;BR /&gt;if [ $? -eq 0 ]; then&lt;BR /&gt;  echo "task1 completedok"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 29 Jul 2001 11:37:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558298#M725007</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-07-29T11:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Easy shell script (korn) question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558299#M725008</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;By far the easist method is you don't care about the order of execution is:&lt;BR /&gt;&lt;BR /&gt;cmd1.sh &amp;amp;&lt;BR /&gt;cmd2.sh &amp;amp;&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;wait will then pause the parent shell until all child processes have completed.&lt;BR /&gt;&lt;BR /&gt;A variation on this is:&lt;BR /&gt;(cmd1.sh; cmd2.sh) &amp;amp;&lt;BR /&gt;cmd3.sh&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;In this case cmd2.sh does not start until cmd1.sh has finished. cmd3.sh run concurrently with cmd1.sh,cmd2.sh. Control does not return until all child processes have finished.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 29 Jul 2001 18:50:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558299#M725008</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-07-29T18:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Easy shell script (korn) question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558300#M725009</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;By far the easist method is you don't care about the order of execution is:&lt;BR /&gt;&lt;BR /&gt;cmd1.sh &amp;amp;&lt;BR /&gt;cmd2.sh &amp;amp;&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;wait will then pause the parent shell until all child processes have completed.&lt;BR /&gt;&lt;BR /&gt;A variation on this is:&lt;BR /&gt;(cmd1.sh; cmd2.sh) &amp;amp;&lt;BR /&gt;cmd3.sh &amp;amp;&lt;BR /&gt;# I missed this ampersand in the prior posting&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;In this case cmd2.sh does not start until cmd1.sh has finished. cmd3.sh run concurrently with cmd1.sh,cmd2.sh. Control does not return until all child processes have finished.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 29 Jul 2001 18:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558300#M725009</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-07-29T18:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Easy shell script (korn) question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558301#M725010</link>
      <description>Hi Jeanine,&lt;BR /&gt;&lt;BR /&gt;example :&lt;BR /&gt;&lt;BR /&gt;cmd1 &amp;amp;&lt;BR /&gt;cmd2 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;cmd3&lt;BR /&gt;&lt;BR /&gt;cmd3 will execute only and only if cmd1 AND cmd2 finish ( both of then )&lt;BR /&gt;&lt;BR /&gt;Note : wait is a synchronizing point.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Magdi</description>
      <pubDate>Mon, 30 Jul 2001 10:37:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-shell-script-korn-question/m-p/2558301#M725010</guid>
      <dc:creator>Magdi KAMAL</dc:creator>
      <dc:date>2001-07-30T10:37:50Z</dc:date>
    </item>
  </channel>
</rss>

