trap

Basic Linux Command Example: 

 

Get help on Linux trap Command.

 

   Linux trap command is use to trap signals and other events on Linux system.  The Linux trap command is one of bash shell built in command.  The command example below show how to get trap command manual or help on Linux trap command using shell command, this help show information on how to use the Linux trap command, the trap command options and the arguments that can be use with Linux trap command.

 

Get Linux trap command help

 

  Execute help command and the name of Linux command that we want the help file, the example below we execute help command with -m option to get the help for trap command using the manpage format.

trap linux command

[linux@fedora11 ~]$ help -m trap

NAME

    trap - Trap signals and other events.

 

SYNOPSIS

    trap [-lp] [[arg] signal_spec ...]

 

DESCRIPTION

    Trap signals and other events.

 

    Defines and activates handlers to be run when the shell receives signals

    or other conditions.

 

    ARG is a command to be read and executed when the shell receives the

    signal(s) SIGNAL_SPEC.  If ARG is absent (and a single SIGNAL_SPEC

    is supplied) or `-', each specified signal is reset to its original

    value.  If ARG is the null string each SIGNAL_SPEC is ignored by the

    shell and by the commands it invokes.

 

    If a SIGNAL_SPEC is EXIT (0) ARG is executed on exit from the shell.  If

    a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command.

 

    If no arguments are supplied, trap prints the list of commands associated

    with each signal.

 

    Options:

      -l        print a list of signal names and their corresponding numbers

      -p        display the trap commands associated with each SIGNAL_SPEC

 

    Each SIGNAL_SPEC is either a signal name in <signal.h> or a signal number.

    Signal names are case insensitive and the SIG prefix is optional.  A

    signal may be sent to the shell with "kill -signal $$".

 

    Exit Status:

    Returns success unless a SIGSPEC is invalid or an invalid option is given.

 

SEE ALSO

    bash(1)

 

IMPLEMENTATION

    GNU bash, version 4.0.16(1)-release (i386-redhat-linux-gnu)

    Copyright (C) 2009 Free Software Foundation, Inc.

    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

 

[linux@fedora11 ~]$

 

Keywords: trap, trap command, linux trap command, trap linux command, linux command trap, trap command manual, trap manual, trap help, help trap, command trap help, help trap command