<?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: How to stop an endless loop with trap? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829249#M938047</link>
    <description>&lt;BR /&gt;Write better scripts, by not having infinite loops! That's the first rule of programming.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
    <pubDate>Sat, 19 Oct 2002 01:37:41 GMT</pubDate>
    <dc:creator>harry d brown jr</dc:creator>
    <dc:date>2002-10-19T01:37:41Z</dc:date>
    <item>
      <title>How to stop an endless loop with trap?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829248#M938046</link>
      <description>How do I stop my while loop by using 'trap'? I don't want my shell script to use ctrl-c.&lt;BR /&gt;-------------&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;trap '???' ? #Problem: How to trap?&lt;BR /&gt;while:&lt;BR /&gt;do&lt;BR /&gt;  echo Program is looping&lt;BR /&gt;done&lt;BR /&gt;-------------&lt;BR /&gt;How can I kill it while I'm having an endless loop?&lt;BR /&gt;</description>
      <pubDate>Sat, 19 Oct 2002 01:07:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829248#M938046</guid>
      <dc:creator>cybermilky</dc:creator>
      <dc:date>2002-10-19T01:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop an endless loop with trap?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829249#M938047</link>
      <description>&lt;BR /&gt;Write better scripts, by not having infinite loops! That's the first rule of programming.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Sat, 19 Oct 2002 01:37:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829249#M938047</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-10-19T01:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop an endless loop with trap?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829250#M938048</link>
      <description>&lt;BR /&gt;give this link a once over:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x022718276953d61190040090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x022718276953d61190040090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Sat, 19 Oct 2002 10:16:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829250#M938048</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-10-19T10:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop an endless loop with trap?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829251#M938049</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;well, why not use signal #1 (SIGHUP) and send that signal from another shell-session to that running script?&lt;BR /&gt;&lt;BR /&gt;trap "echo trapped" 1 # set trap&lt;BR /&gt;#your loop here&lt;BR /&gt;trap "" 1 # release trap&lt;BR /&gt;&lt;BR /&gt;Now you start it, say into the background:&lt;BR /&gt;&lt;BR /&gt;./your-script &amp;amp; # now $! is the PID of this process&lt;BR /&gt;pid=$!&lt;BR /&gt;&lt;BR /&gt;And finally, as soon as you decide to stop it:&lt;BR /&gt;&lt;BR /&gt;kill -1 $pid&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
      <pubDate>Sat, 19 Oct 2002 11:54:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-stop-an-endless-loop-with-trap/m-p/2829251#M938049</guid>
      <dc:creator>Wodisch_1</dc:creator>
      <dc:date>2002-10-19T11:54:42Z</dc:date>
    </item>
  </channel>
</rss>

