<?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: Can't use CTRL-C to exit a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046024#M135380</link>
    <description>Rodel,&lt;BR /&gt;&lt;BR /&gt;The command won't disable CTRL+D, although this shouldn't matter as the user is in a script, and CTRL+D is normally an exit from a shell.&lt;BR /&gt;&lt;BR /&gt;The hangup and quit signals,(from man kill);&lt;BR /&gt;&lt;BR /&gt;1 SIGHUP Hangup     Terminate; can be trapped&lt;BR /&gt;2 SIGINT Interrupt  Terminate; can be trapped&lt;BR /&gt;3 SIGQUIT Quit      Terminate with core dump; can be trapped&lt;BR /&gt;&lt;BR /&gt;The Quit signal can be triggered manually using CTRL+\ (another potential way for users to exit the script).&lt;BR /&gt;&lt;BR /&gt;The hangup is more normally sent directly via the kill command (kill -HUP PID)&lt;BR /&gt;&lt;BR /&gt;If you use kill -l (that's a lower case L), it will list all signals that can be sent from the kill command, most of which can be trapped if necessary.  More details can be seen in the man pages using&lt;BR /&gt;&lt;BR /&gt;man 5 signal</description>
    <pubDate>Mon, 11 Aug 2003 08:02:31 GMT</pubDate>
    <dc:creator>Chris Wilshaw</dc:creator>
    <dc:date>2003-08-11T08:02:31Z</dc:date>
    <item>
      <title>Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046018#M135374</link>
      <description>Hi to all, I've created a menu-based script and I want the user to exit from the script using the available options and not by using CTRL-C. How would I implement this? What snippet of code can I add in my script so that this will be possible?&lt;BR /&gt;&lt;BR /&gt;TIA</description>
      <pubDate>Mon, 11 Aug 2003 07:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046018#M135374</guid>
      <dc:creator>Rodel D. Bautista</dc:creator>
      <dc:date>2003-08-11T07:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046019#M135375</link>
      <description>If you just want to disable CTRL+C, you should add the line &lt;BR /&gt;&lt;BR /&gt;trap "" 2 &lt;BR /&gt;&lt;BR /&gt;to the script.&lt;BR /&gt;&lt;BR /&gt;For extra protection (from hangup and quit signals)&lt;BR /&gt;&lt;BR /&gt;use trap "" 1 2 3</description>
      <pubDate>Mon, 11 Aug 2003 07:11:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046019#M135375</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-08-11T07:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046020#M135376</link>
      <description>Put this in your script at the beginning.&lt;BR /&gt;&lt;BR /&gt;stty intr ^-&lt;BR /&gt;&lt;BR /&gt;this will change the interrupt routine to undefined.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Roland</description>
      <pubDate>Mon, 11 Aug 2003 07:19:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046020#M135376</guid>
      <dc:creator>RolandH</dc:creator>
      <dc:date>2003-08-11T07:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046021#M135377</link>
      <description>You can introduced a case statement where you can check for the condition and then exit out from the script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 11 Aug 2003 07:23:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046021#M135377</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2003-08-11T07:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046022#M135378</link>
      <description>Sir Chris, will the command also disable CTRL-D? What do you mean when you say that it will also disable hangup and quit signals?&lt;BR /&gt;&lt;BR /&gt;again, thanks.</description>
      <pubDate>Mon, 11 Aug 2003 07:24:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046022#M135378</guid>
      <dc:creator>Rodel D. Bautista</dc:creator>
      <dc:date>2003-08-11T07:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046023#M135379</link>
      <description>Hi Rodel,&lt;BR /&gt;&lt;BR /&gt;PLEASE, do not waht I suggest before.&lt;BR /&gt;It switched off the interrupted routine for the shell you have in wihich you start the script, too. So do that in your script:&lt;BR /&gt;&lt;BR /&gt;trap "" 2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Roland&lt;BR /&gt;(NO POINTS ,PLEASE)</description>
      <pubDate>Mon, 11 Aug 2003 07:27:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046023#M135379</guid>
      <dc:creator>RolandH</dc:creator>
      <dc:date>2003-08-11T07:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046024#M135380</link>
      <description>Rodel,&lt;BR /&gt;&lt;BR /&gt;The command won't disable CTRL+D, although this shouldn't matter as the user is in a script, and CTRL+D is normally an exit from a shell.&lt;BR /&gt;&lt;BR /&gt;The hangup and quit signals,(from man kill);&lt;BR /&gt;&lt;BR /&gt;1 SIGHUP Hangup     Terminate; can be trapped&lt;BR /&gt;2 SIGINT Interrupt  Terminate; can be trapped&lt;BR /&gt;3 SIGQUIT Quit      Terminate with core dump; can be trapped&lt;BR /&gt;&lt;BR /&gt;The Quit signal can be triggered manually using CTRL+\ (another potential way for users to exit the script).&lt;BR /&gt;&lt;BR /&gt;The hangup is more normally sent directly via the kill command (kill -HUP PID)&lt;BR /&gt;&lt;BR /&gt;If you use kill -l (that's a lower case L), it will list all signals that can be sent from the kill command, most of which can be trapped if necessary.  More details can be seen in the man pages using&lt;BR /&gt;&lt;BR /&gt;man 5 signal</description>
      <pubDate>Mon, 11 Aug 2003 08:02:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046024#M135380</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-08-11T08:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046025#M135381</link>
      <description>Sir Chris, how would I enable again CTRL-C because one option of my script goes to a shell prompt and I can't use CTRL-C to interrupt a running process/command?&lt;BR /&gt;&lt;BR /&gt;again, thanks.</description>
      <pubDate>Mon, 11 Aug 2003 08:10:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046025#M135381</guid>
      <dc:creator>Rodel D. Bautista</dc:creator>
      <dc:date>2003-08-11T08:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use CTRL-C to exit a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046026#M135382</link>
      <description>To re-enable the signal, use&lt;BR /&gt;&lt;BR /&gt;trap - 2, then call your shell.&lt;BR /&gt;&lt;BR /&gt;The - sets the trap for whichever signals you list after it back to their default values.&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 11 Aug 2003 08:17:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-t-use-ctrl-c-to-exit-a-script/m-p/3046026#M135382</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-08-11T08:17:06Z</dc:date>
    </item>
  </channel>
</rss>

