Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/bin/sh Pull up revision 1.41 (requested by jonb):
details: https://anonhg.NetBSD.org/src/rev/ca165c85cf7a
branches: netbsd-1-5
changeset: 492816:ca165c85cf7a
user: he <he%NetBSD.org@localhost>
date: Sat Feb 23 15:54:10 2002 +0000
description:
Pull up revision 1.41 (requested by jonb):
Extend functionality of the trap builtin, which now more closely
follows POSIX recommendations:
o accept signal names as well as signal numbers
o add ``-l'' option which outputs list of valid signals
o add signal EXIT to list of valid signals
o an ``-'' in the action part will reset signal to default behaviour
o changed standard output of ``trap'' to make it suitable as
subsequent input
diffstat:
bin/sh/sh.1 | 48 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 41 insertions(+), 7 deletions(-)
diffs (73 lines):
diff -r dbb0afeefc19 -r ca165c85cf7a bin/sh/sh.1
--- a/bin/sh/sh.1 Sat Feb 23 15:53:50 2002 +0000
+++ b/bin/sh/sh.1 Sat Feb 23 15:54:10 2002 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sh.1,v 1.33.4.6 2001/04/04 16:15:24 he Exp $
+.\" $NetBSD: sh.1,v 1.33.4.7 2002/02/23 15:54:10 he Exp $
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -1366,23 +1366,57 @@
.Ic shift
does nothing.
.It Xo trap
+.Op Fl l
+.Xc
+.It Xo trap
.Op Ar action
.Ar signal...
.Xc
Cause the shell to parse and execute action when any of the specified
-signals are received. The signals are specified by signal number. If
+signals are received. The signals are specified by signal number or as
+the name of the signal.
+If
.Ar signal
is
.Li 0 ,
the action is executed when the shell exits.
.Ar action
-may be null or omitted; the former causes the specified signal to be
-ignored and the latter causes the default action to be taken. When the
-shell forks off a subshell, it resets trapped (but not ignored) signals to
-the default action. The
+may be null, which cause the specified signals to be ignored.
+With
+.Ar action
+omitted or set to `-' the specified signals are set to their default action.
+When the shell forks off a subshell, it resets trapped (but not ignored)
+signals to the default action. The
.Ic trap
command has no effect on signals that were
-ignored on entry to the shell.
+ignored on entry to the shell.
+Issuing
+.Ic trap
+with option
+.Ar -l
+will print a list of valid signal names.
+.Ic trap
+without any arguments cause it to write a list of signals and their
+associated action to the standard output in a format that is suitable
+as an input to the shell that achieves the same trapping results.
+.Pp
+Examples:
+.Pp
+.Dl trap
+.Pp
+List trapped signals and their corresponding action
+.Pp
+.Dl trap -l
+.Pp
+Print a list of valid signals
+.Pp
+.Dl trap '' SIGINT QUIT tstp 30
+.Pp
+Ignore signals INT QUIT TSTP USR1
+.Pp
+.Dl trap date INT
+.Pp
+Print date upon receiving signal INT
.It type Op Ar name ...
Interpret each name as a command and print the resolution of the command
search. Possible resolutions are:
Home |
Main Index |
Thread Index |
Old Index