<?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: Exit loop with any keystroke in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117413#M898734</link>
    <description>You can try this:&lt;BR /&gt;&lt;BR /&gt;stty raw;char=`dd if=/dev/tty count=1 2&amp;gt;/dev/null`;stty -raw&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;mark</description>
    <pubDate>Wed, 12 Nov 2003 13:49:51 GMT</pubDate>
    <dc:creator>Mark Greene_1</dc:creator>
    <dc:date>2003-11-12T13:49:51Z</dc:date>
    <item>
      <title>Exit loop with any keystroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117412#M898733</link>
      <description>I have been reading the forums looking for a solution, searching on trap, stty... but I am at a loss...here's my issue:&lt;BR /&gt;&lt;BR /&gt;I have a simple script that enters into a continous loop and runs a program to dipslay the contents of a file to the screen.  I know I can exit out of the loop by hitting Ctrl-C, etc.&lt;BR /&gt;&lt;BR /&gt;What I would like to do is exit the loop when a user presses ANY key, not just return, or Ctrl-C, etc.&lt;BR /&gt;&lt;BR /&gt;Is there a way to do this?</description>
      <pubDate>Wed, 12 Nov 2003 13:15:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117412#M898733</guid>
      <dc:creator>Brian K. Arnholt</dc:creator>
      <dc:date>2003-11-12T13:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Exit loop with any keystroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117413#M898734</link>
      <description>You can try this:&lt;BR /&gt;&lt;BR /&gt;stty raw;char=`dd if=/dev/tty count=1 2&amp;gt;/dev/null`;stty -raw&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;mark</description>
      <pubDate>Wed, 12 Nov 2003 13:49:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117413#M898734</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2003-11-12T13:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Exit loop with any keystroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117414#M898735</link>
      <description>Dug around on google and hacked together this.&lt;BR /&gt;&lt;BR /&gt;Only I seem to have to hit 3 keystrokes to get it to quit.&lt;BR /&gt;&lt;BR /&gt;Might give you some ideas.&lt;BR /&gt;&lt;BR /&gt;Basically save the stty settings, send a message, turn off echo and -icanon and then have dd wait for an input character then restore the old stty settings:&lt;BR /&gt;&lt;BR /&gt;old_tty_setting=$(stty -g)&lt;BR /&gt;echo "Hit key to break loop "&lt;BR /&gt;stty -icanon -echo&lt;BR /&gt;usethis=$(dd bs=1 count=1 of=/dev/null)&lt;BR /&gt;stty $old_tty_setting&lt;BR /&gt;&lt;BR /&gt;Hope that helps or maybe someone can suggest why it would take multiple characters.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Nov 2003 14:04:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117414#M898735</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2003-11-12T14:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exit loop with any keystroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117415#M898736</link>
      <description>Check this link.  Good example script and explanation.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.dbaoncall.net/references/ex_one_char.html" target="_blank"&gt;http://www.dbaoncall.net/references/ex_one_char.html&lt;/A&gt;</description>
      <pubDate>Wed, 12 Nov 2003 15:42:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117415#M898736</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2003-11-12T15:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Exit loop with any keystroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117416#M898737</link>
      <description>Thanks to all, Jim's link was the cleanest.&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Nov 2003 09:26:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-loop-with-any-keystroke/m-p/3117416#M898737</guid>
      <dc:creator>Brian K. Arnholt</dc:creator>
      <dc:date>2003-11-13T09:26:58Z</dc:date>
    </item>
  </channel>
</rss>

