<?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: trap in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730786#M254441</link>
    <description>sorry there was a typo error..&lt;BR /&gt;&lt;BR /&gt;it NOT equivallent.&lt;BR /&gt;&lt;BR /&gt;and setting : dosent trap the signals.&lt;BR /&gt;</description>
    <pubDate>Tue, 14 Feb 2006 00:32:59 GMT</pubDate>
    <dc:creator>Sivakumar TS</dc:creator>
    <dc:date>2006-02-14T00:32:59Z</dc:date>
    <item>
      <title>trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730776#M254431</link>
      <description>what does the folloing line mean in /home/user/.profile&lt;BR /&gt;&lt;BR /&gt;trap : 1 2 3</description>
      <pubDate>Mon, 13 Feb 2006 23:44:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730776#M254431</guid>
      <dc:creator>Khashru</dc:creator>
      <dc:date>2006-02-13T23:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730777#M254432</link>
      <description>Hi Khashru,&lt;BR /&gt;&lt;BR /&gt;         Trap command is usually used in shell scripts to trap signals. To know different signal's and its significance try man pag of kill command.&lt;BR /&gt;&lt;BR /&gt;          This command command syntax is&lt;BR /&gt;&lt;BR /&gt;trap {commands} {signal number list}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;       For example let us assume, you shell script creates lot of temp files in the course of execution.When I kill the shell script while it is running using&lt;BR /&gt;&lt;BR /&gt;     kill -15 PID, This actually kills the process and exits without any additional execution. Instead you shell scripts sets trap like the folowing..&lt;BR /&gt;&lt;BR /&gt;         trap "rm /tmp/tempfile" 15&lt;BR /&gt;&lt;BR /&gt;     then the sript will execute the command "rm /tmp/tempfile" when its killed with the signal 15.&lt;BR /&gt;&lt;BR /&gt;      I hope this explanation helped,&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Senthil Kumar .A</description>
      <pubDate>Mon, 13 Feb 2006 23:54:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730777#M254432</guid>
      <dc:creator>Senthil Kumar .A_1</dc:creator>
      <dc:date>2006-02-13T23:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730778#M254433</link>
      <description>Hi Khashru, &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=30026" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=30026&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Mon, 13 Feb 2006 23:54:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730778#M254433</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-13T23:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730779#M254434</link>
      <description>Hi Khashru, &lt;BR /&gt;&lt;BR /&gt;Some important signals are, &lt;BR /&gt;&lt;BR /&gt;Signals 1(hangup)&lt;BR /&gt;Singnal 2(interrupt) &lt;BR /&gt;Singnal 3(quit) &lt;BR /&gt;Singnal 0 (shell exit)&lt;BR /&gt;Signal 15 (terninate)&lt;BR /&gt;&lt;BR /&gt;-Arun &lt;BR /&gt;</description>
      <pubDate>Tue, 14 Feb 2006 00:00:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730779#M254434</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-14T00:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730780#M254435</link>
      <description>what is : after trap command. it is used to stop ctrl+c.</description>
      <pubDate>Tue, 14 Feb 2006 00:02:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730780#M254435</guid>
      <dc:creator>Khashru</dc:creator>
      <dc:date>2006-02-14T00:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730781#M254436</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;By giving the follwoing enty in profile.&lt;BR /&gt;&lt;BR /&gt;trap " " 1 2 3&lt;BR /&gt;&lt;BR /&gt;you can "trap"/"supress" those signals.&lt;BR /&gt;&lt;BR /&gt;it means... if the user executes Ctrl+C in a menu, the program won ger terminated and he wont get the shell prompt. Its done for security reasons.&lt;BR /&gt;&lt;BR /&gt;With Regards,&lt;BR /&gt;&lt;BR /&gt;Siva.</description>
      <pubDate>Tue, 14 Feb 2006 00:04:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730781#M254436</guid>
      <dc:creator>Sivakumar TS</dc:creator>
      <dc:date>2006-02-14T00:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730782#M254437</link>
      <description>yes. but I typed trap : 1 2 3  not trap "". I want to know why : not ""</description>
      <pubDate>Tue, 14 Feb 2006 00:06:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730782#M254437</guid>
      <dc:creator>Khashru</dc:creator>
      <dc:date>2006-02-14T00:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730783#M254438</link>
      <description>&lt;BR /&gt;Hi Khashru,&lt;BR /&gt;&lt;BR /&gt;: is equivallent to  "" itself....&lt;BR /&gt;&lt;BR /&gt;go thru the follwing,&lt;BR /&gt;&lt;BR /&gt;server[/]#trap&lt;BR /&gt;trap -- 'echo '\''logout root'\' EXIT&lt;BR /&gt;server[/]#trap : 1 2 3&lt;BR /&gt;server[/]#trap&lt;BR /&gt;trap -- : QUIT&lt;BR /&gt;trap -- : INT&lt;BR /&gt;trap -- : HUP&lt;BR /&gt;trap -- 'echo '\''logout root'\' EXIT&lt;BR /&gt;server[/]#trap "" 4&lt;BR /&gt;server[/]#trap&lt;BR /&gt;trap -- '' ILL&lt;BR /&gt;trap -- : QUIT&lt;BR /&gt;trap -- : INT&lt;BR /&gt;trap -- : HUP&lt;BR /&gt;trap -- 'echo '\''logout root'\' EXIT&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;With Regards,&lt;BR /&gt;&lt;BR /&gt;Siva.</description>
      <pubDate>Tue, 14 Feb 2006 00:28:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730783#M254438</guid>
      <dc:creator>Sivakumar TS</dc:creator>
      <dc:date>2006-02-14T00:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730784#M254439</link>
      <description>I typed trap : 1 2 3 not trap "". I want to know why : not ""&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;&lt;BR /&gt;trap is using syntax as,&lt;BR /&gt;&lt;BR /&gt;trap "function execution" signal number&lt;BR /&gt;&lt;BR /&gt;trap "" 1 2 3&lt;BR /&gt;&lt;BR /&gt;"" -&amp;gt; Null string .. If it gets the singal then it will do anything.&lt;BR /&gt;&lt;BR /&gt;signal()&lt;BR /&gt;{&lt;BR /&gt;  echo "Got signal"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;trap "signal" 1 2 3&lt;BR /&gt;&lt;BR /&gt;when ever it gets signal it will call signal shell function.&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Tue, 14 Feb 2006 00:29:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730784#M254439</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-02-14T00:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730785#M254440</link>
      <description>It is always better to use man pages to get more information.&lt;BR /&gt;&lt;BR /&gt;See ksh man page for trap command.&lt;BR /&gt;&lt;BR /&gt;     % trap [arg] [sig ...]&lt;BR /&gt;                    arg is a command read and executed when the shell&lt;BR /&gt;                    receives signal(s) sig.  (Note that arg is scanned once&lt;BR /&gt;                    when the trap is set and once when the trap is taken.)&lt;BR /&gt;                    Each sig can be given as a number or name of the&lt;BR /&gt;                    signal.  Trap commands are executed in signal number&lt;BR /&gt;                    order.  Any attempt to set a trap on a signal that was&lt;BR /&gt;                    ignored upon entering the current shell has no effect.&lt;BR /&gt;                    If arg is omitted or is -, all traps for sig are reset&lt;BR /&gt;                    to their original values.  If arg is the null string,&lt;BR /&gt;                    this signal is ignored by the shell and by the commands&lt;BR /&gt;                    it invokes.  If sig is DEBUG, arg is executed after&lt;BR /&gt;                    each command.  If sig is ERR, arg is executed whenever&lt;BR /&gt;                    a command has a non-zero exit code.  If sig is 0 or&lt;BR /&gt;                    EXIT and the trap statement is executed inside the body&lt;BR /&gt;                    of a function, the command arg is executed after the&lt;BR /&gt;                    function completes.  If sig is 0 or EXIT for a trap set&lt;BR /&gt;                    outside any function, the command arg is executed on&lt;BR /&gt;                    exit from the shell.  The trap command with no&lt;BR /&gt;                    arguments prints a list of commands associated with&lt;BR /&gt;                    each signal number.&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Tue, 14 Feb 2006 00:30:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730785#M254440</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-02-14T00:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730786#M254441</link>
      <description>sorry there was a typo error..&lt;BR /&gt;&lt;BR /&gt;it NOT equivallent.&lt;BR /&gt;&lt;BR /&gt;and setting : dosent trap the signals.&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Feb 2006 00:32:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730786#M254441</guid>
      <dc:creator>Sivakumar TS</dc:creator>
      <dc:date>2006-02-14T00:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730787#M254442</link>
      <description>but it works. i have used : and it works.</description>
      <pubDate>Tue, 14 Feb 2006 00:34:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730787#M254442</guid>
      <dc:creator>Khashru</dc:creator>
      <dc:date>2006-02-14T00:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730788#M254443</link>
      <description>Check this thread for Control -C&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=943834" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=943834&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Tue, 14 Feb 2006 00:35:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730788#M254443</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-14T00:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: trap</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730789#M254444</link>
      <description>Hi Khashru, &lt;BR /&gt;&lt;BR /&gt;Also, worth reading these pages, &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://unix.ittoolbox.com/groups/technical-functional/hp-ux-l/893492" target="_blank"&gt;http://unix.ittoolbox.com/groups/technical-functional/hp-ux-l/893492&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://unix.ittoolbox.com/groups/technical-functional/hp-ux-l/893922" target="_blank"&gt;http://unix.ittoolbox.com/groups/technical-functional/hp-ux-l/893922&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Tue, 14 Feb 2006 00:40:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap/m-p/3730789#M254444</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-14T00:40:48Z</dc:date>
    </item>
  </channel>
</rss>

