<?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: Trapping Ctrl-C in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049868#M719090</link>
    <description>trap "" 1 2 3 to ignore the signals-123&lt;BR /&gt;trap 1 2 3 to trap the signals.</description>
    <pubDate>Fri, 15 Aug 2003 14:12:28 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2003-08-15T14:12:28Z</dc:date>
    <item>
      <title>Trapping Ctrl-C</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049866#M719088</link>
      <description>I have a script that is called to force user to reset there password and I do not want them to be able to Ctrl-C out of it.&lt;BR /&gt;I believe a SIGINT (2) is to trap the Ctrl-C but when I code: trap 2 in the script it still allows me to break out of it with Ctrl-C.&lt;BR /&gt;If possible I would also like it to display, Control-C not allowed if they do try it and reissue the password command for them....&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Aug 2003 14:04:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049866#M719088</guid>
      <dc:creator>MikeL_4</dc:creator>
      <dc:date>2003-08-15T14:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trapping Ctrl-C</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049867#M719089</link>
      <description>Hi Mike:&lt;BR /&gt;&lt;BR /&gt;A trap in your script like this should work:&lt;BR /&gt;&lt;BR /&gt;trap 'echo Ctrl_C not allowed!' INT&lt;BR /&gt;&lt;BR /&gt;Do 'stty a' to confirm that the Control_C sequence is mapped to SIGINT.  You should see:&lt;BR /&gt;&lt;BR /&gt;intr = ^C;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Aug 2003 14:11:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049867#M719089</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-08-15T14:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Trapping Ctrl-C</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049868#M719090</link>
      <description>trap "" 1 2 3 to ignore the signals-123&lt;BR /&gt;trap 1 2 3 to trap the signals.</description>
      <pubDate>Fri, 15 Aug 2003 14:12:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049868#M719090</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2003-08-15T14:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trapping Ctrl-C</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049869#M719091</link>
      <description>This is NOT what you asked, but maybe it will help.  It's how to write a script to trap a "kill" command:&lt;BR /&gt;&lt;BR /&gt;        #!/usr/bin/ksh&lt;BR /&gt;        #&lt;BR /&gt;        #       ~stuart/ksh/traptest.ksh                        SDA  09/25/97&lt;BR /&gt;        #&lt;BR /&gt;        #       This script loops around until it "catches" a signal, sent by a&lt;BR /&gt;        #       kill command.  We will trap SIGINT and SIGQUIT&lt;BR /&gt;        #&lt;BR /&gt;        #       We launch this guy by typing:&lt;BR /&gt;        #&lt;BR /&gt;        #               ksh traptest.ksh &amp;amp;&lt;BR /&gt;        #&lt;BR /&gt;        #       We send the trap by typing:&lt;BR /&gt;        #&lt;BR /&gt;        #               kill -SIGINT &lt;PID&gt;&lt;BR /&gt;        #&lt;BR /&gt;                USAGE="Usage: traptest.ksh"&lt;BR /&gt;        #&lt;BR /&gt;&lt;BR /&gt;        trap 'print "Received INT; c = $c"' INT&lt;BR /&gt;        trap 'print "Received QUIT; rt = $rt"' QUIT&lt;BR /&gt;&lt;BR /&gt;        integer c=0&lt;BR /&gt;        integer rt=0&lt;BR /&gt;&lt;BR /&gt;        while ((c&amp;lt;200000))&lt;BR /&gt;        do&lt;BR /&gt;                ((c=c+1))&lt;BR /&gt;                ((rt=rt+c))&lt;BR /&gt;        done&lt;BR /&gt;&lt;BR /&gt;        print "The final answer is c = $c; rt = $rt "&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;e.      OUTPUT:&lt;BR /&gt;&lt;BR /&gt;                $ ksh traptest.ksh &amp;amp;&lt;BR /&gt;                [1]     5345&lt;BR /&gt;                $ jobs&lt;BR /&gt;                [1] +  Running                 ksh traptest.ksh &amp;amp;&lt;BR /&gt;                $ kill -SIGINT %1&lt;BR /&gt;                $ Received INT; c = 66551&lt;BR /&gt;&lt;BR /&gt;                $ kill -SIGINT %1&lt;BR /&gt;                $ Received INT; c = 110368&lt;BR /&gt;                $ kill -SIGQUIT %1&lt;BR /&gt;                $ Received QUIT; rt = -883017042&lt;BR /&gt;&lt;BR /&gt;                $ The final answer is c = 200000; rt = -1474736480&lt;BR /&gt;&lt;BR /&gt;                [1] +  Done                    ksh traptest.ksh &amp;amp;&lt;/PID&gt;</description>
      <pubDate>Fri, 15 Aug 2003 14:15:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trapping-ctrl-c/m-p/3049869#M719091</guid>
      <dc:creator>Stuart Abramson_2</dc:creator>
      <dc:date>2003-08-15T14:15:14Z</dc:date>
    </item>
  </channel>
</rss>

