<?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 Re: rexec acts as break in ksh while loop? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677865#M907348</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Prefer a for loop to a while loop.&lt;BR /&gt;&lt;BR /&gt;first.sh:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;for node in `cat nodelist`&lt;BR /&gt;do&lt;BR /&gt;  second.sh $node&lt;BR /&gt;  if [ -e /tmp/foundit ]&lt;BR /&gt;  then&lt;BR /&gt;    rm -f /tmp/foundit&lt;BR /&gt;    exit 0&lt;BR /&gt;  fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;second.sh:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;if [ "$1" != "`hostname`" ]&lt;BR /&gt;then&lt;BR /&gt;  rexec $1 third.sh&lt;BR /&gt;  touch /tmp/foundit&lt;BR /&gt;else&lt;BR /&gt;  ksh -c third.sh&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
    <pubDate>Thu, 07 Mar 2002 09:29:34 GMT</pubDate>
    <dc:creator>Steven Sim Kok Leong</dc:creator>
    <dc:date>2002-03-07T09:29:34Z</dc:date>
    <item>
      <title>rexec acts as break in ksh while loop?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677864#M907347</link>
      <description>This is probably a simple one. I have three ksh shell scripts. The first is a loop that scans a list of nodes using while and calls the second with the node as the parameter. &lt;BR /&gt;&lt;BR /&gt;The second says if the node is hostname, execute the third shell script using ksh -c, otherwise execute it on the remote node using rexec.&lt;BR /&gt;&lt;BR /&gt;The loop continues working until it reaches a remote node. It executes the script on the remote node, but then the loop exits.</description>
      <pubDate>Thu, 07 Mar 2002 09:18:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677864#M907347</guid>
      <dc:creator>Ryan Kogelheide</dc:creator>
      <dc:date>2002-03-07T09:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: rexec acts as break in ksh while loop?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677865#M907348</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Prefer a for loop to a while loop.&lt;BR /&gt;&lt;BR /&gt;first.sh:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;for node in `cat nodelist`&lt;BR /&gt;do&lt;BR /&gt;  second.sh $node&lt;BR /&gt;  if [ -e /tmp/foundit ]&lt;BR /&gt;  then&lt;BR /&gt;    rm -f /tmp/foundit&lt;BR /&gt;    exit 0&lt;BR /&gt;  fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;second.sh:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;if [ "$1" != "`hostname`" ]&lt;BR /&gt;then&lt;BR /&gt;  rexec $1 third.sh&lt;BR /&gt;  touch /tmp/foundit&lt;BR /&gt;else&lt;BR /&gt;  ksh -c third.sh&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Thu, 07 Mar 2002 09:29:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677865#M907348</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-03-07T09:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: rexec acts as break in ksh while loop?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677866#M907349</link>
      <description>That seems to do the trick. Can you tell me why "for" works and "while" does not?&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Mar 2002 10:24:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677866#M907349</guid>
      <dc:creator>Ryan Kogelheide</dc:creator>
      <dc:date>2002-03-07T10:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: rexec acts as break in ksh while loop?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677867#M907350</link>
      <description>Hi Ryan,&lt;BR /&gt;&lt;BR /&gt;With while loops, any remsh/rexec calls within the loop need to use the -n switch - here's the man entry to explain:&lt;BR /&gt;&lt;BR /&gt;===================&lt;BR /&gt;By default, remsh reads its standard input and sends it to the remote command because remsh has no way to determine whether the remote command requires input.  The -n option redirects standard input to remsh from /dev/null.  This is useful when running a shell script containing a remsh command, since otherwise remsh may use input not intended for it.&lt;BR /&gt;===================&lt;BR /&gt;&lt;BR /&gt;Because "while" uses read, but "for" doesn't, this hopefully explains the difference.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Thu, 07 Mar 2002 10:48:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677867#M907350</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-03-07T10:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: rexec acts as break in ksh while loop?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677868#M907351</link>
      <description>Woohoo!&lt;BR /&gt;&lt;BR /&gt;That explains another problem I was having. (the -n)</description>
      <pubDate>Thu, 07 Mar 2002 12:11:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rexec-acts-as-break-in-ksh-while-loop/m-p/2677868#M907351</guid>
      <dc:creator>Ryan Kogelheide</dc:creator>
      <dc:date>2002-03-07T12:11:41Z</dc:date>
    </item>
  </channel>
</rss>

