<?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: Shell Script: trap in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837671#M90571</link>
    <description>A simpler answer may be;&lt;BR /&gt;Depending on what your script is doing, and how the script is to be used.  You might be able to create a wrapper script, that calls your menu script. &lt;BR /&gt;&lt;BR /&gt;#!/usr/sbin/ksh&lt;BR /&gt;/home/my_script&lt;BR /&gt;exit</description>
    <pubDate>Fri, 01 Nov 2002 20:33:02 GMT</pubDate>
    <dc:creator>RedLetter</dc:creator>
    <dc:date>2002-11-01T20:33:02Z</dc:date>
    <item>
      <title>Shell Script: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837666#M90566</link>
      <description>I wrote a menu with shell script.&lt;BR /&gt;&lt;BR /&gt;I am testing and find it is possible to break from the mneu to the shell.&lt;BR /&gt;&lt;BR /&gt;I use:&lt;BR /&gt;trap 1 2 3 4 6&lt;BR /&gt;&lt;BR /&gt;This is what I have found.&lt;BR /&gt;If the user hits Ctl C, it sends a character to screen.&lt;BR /&gt;If the user hits Ctl D, they get logged off the system.&lt;BR /&gt;&lt;BR /&gt;If they hit Ctl C, and then they hit Ctl D, they break to&lt;BR /&gt;the unix prompt.&lt;BR /&gt;&lt;BR /&gt;Is there another trap number to add?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Nov 2002 20:02:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837666#M90566</guid>
      <dc:creator>David Peacock</dc:creator>
      <dc:date>2002-11-01T20:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837667#M90567</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;In order to ignore signals like ctrl C you need to use:&lt;BR /&gt;trap '' 2&lt;BR /&gt;&lt;BR /&gt;That is the action on trap is a null string. Your usage of trap simply resets them to their original values. See man sh-posix for more info.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Fri, 01 Nov 2002 20:19:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837667#M90567</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-11-01T20:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837668#M90568</link>
      <description>First of all,&lt;BR /&gt;trap 1 2 3 is very different from trap '' 1 2 3. The former says restore the signal handlers to their default vaues while the latter says ignore the signal. &lt;BR /&gt;&lt;BR /&gt;Next, you are making some assumptions about Cntl-C and Cntl-D, etc. that are unwarranted. Who is to say what key (if any) generates a SIGINT. You need to also use stty -a to examine these values. One technique that you can use is to use stty to set the intr and quit keys to impossible values so that they can never generate the signals. If you do this, make ceratin that you restore the stty settings to their originals on exit because stty changes affect all processes connected to that tty (or pty port) - not just the current process.&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Nov 2002 20:20:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837668#M90568</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-11-01T20:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837669#M90569</link>
      <description>Correction:&lt;BR /&gt;&lt;BR /&gt;I use:&lt;BR /&gt;&lt;BR /&gt;trap " " 1 2 3 4 6&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Nov 2002 20:30:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837669#M90569</guid>
      <dc:creator>David Peacock</dc:creator>
      <dc:date>2002-11-01T20:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837670#M90570</link>
      <description>Don't include a space in your trap string either.&lt;BR /&gt;&lt;BR /&gt;You MUST have a null string, either two quotes "" or two apostrophes ''.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Fri, 01 Nov 2002 20:32:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837670#M90570</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-11-01T20:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837671#M90571</link>
      <description>A simpler answer may be;&lt;BR /&gt;Depending on what your script is doing, and how the script is to be used.  You might be able to create a wrapper script, that calls your menu script. &lt;BR /&gt;&lt;BR /&gt;#!/usr/sbin/ksh&lt;BR /&gt;/home/my_script&lt;BR /&gt;exit</description>
      <pubDate>Fri, 01 Nov 2002 20:33:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-trap/m-p/2837671#M90571</guid>
      <dc:creator>RedLetter</dc:creator>
      <dc:date>2002-11-01T20:33:02Z</dc:date>
    </item>
  </channel>
</rss>

