
type | 691
Bash and Korn
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
prefix). In addition, the shells support “pseudo-signals,” signal
names or numbers that aren’t real operating system signals but
which direct the shell to perform a specific action. These signals
are:
DEBUG
Execution of any command.
ERR
Nonzero exit status.
EXIT
Exit from shell (usually when shell script finishes).
0 Same as EXIT, for historical compatibility with the Bourne
shell.
KEYBD
A key has been read in emacs, gmacs,orvi editing mode.
ksh93 only.
RETURN
A return is executed, or a script run with
. (dot) or source
finishes. Bash only.
Examples
trap "" INT Ignore interrupts (signal 2)
trap INT Obey interrupts again
Remove a $tmp file when the shell program exits, or if the user logs
out, presses Ctrl-C, or does a kill:
trap "rm -f $tmp; exit" EXIT HUP INT TERM POSIX style
trap "rm -f $tmp; exit" 0 1 2 15 Pre-POSIX Bourne shell style
Print a “clean up” message when the shell program receives signals
SIGHUP, SIGINT, or SIGTERM:
trap 'echo Interrupt! Cleaning up...' HUP INT TERM
true
true
ksh88 alias for :. Bash and ksh93 built-in command that exits with
a true return value.
type
type [-afpPt] commands
Bash version. Show whether each command name is a Unix
command, a built-in command, an alias, a shell keyword, or a
defined shell function.
Options
-a Print all locations in $PATH